Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 8080)
@@ -0,0 +1 @@
+org.gvsig.raster.multifile.io.DefaultMultiFileIOLibrary
Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/resources/multifileformat.dtd
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/resources/multifileformat.dtd	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/resources/multifileformat.dtd	(revision 8080)
@@ -0,0 +1,7 @@
+<!DOCTYPE TimeSeriesFormat [
+<!ELEMENT TimeSeriesFormat (Name,URIs)>
+<!ELEMENT Name (#PCDATA)>
+<!ELEMENT URIs (URI)+>
+
+<!ELEMENT URI (#PCDATA)>
+]>
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/resources/multifileformat.dtd
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileDataParametersImpl.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileDataParametersImpl.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileDataParametersImpl.java	(revision 8080)
@@ -0,0 +1,235 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.raster.multifile.io;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
+import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.fmap.dal.spi.DataStoreProvider;
+import org.gvsig.raster.impl.provider.AbstractRasterProvider;
+import org.gvsig.raster.impl.provider.RasterProvider;
+import org.gvsig.raster.impl.store.AbstractRasterDataParameters;
+import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters;
+import org.gvsig.raster.impl.store.DefaultRasterStore;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Parameters for the Multifile provider
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class MultiFileDataParametersImpl extends AbstractRasterFileDataParameters implements MultiFileDataParameters {
+	private List<RasterProvider>    providerList = null;
+
+	public MultiFileDataParametersImpl() {
+		super();
+		providerList = new ArrayList<RasterProvider>();
+		initialize();
+	}
+
+	protected void initialize() {
+		delegatedDynObject = (DelegatedDynObject) ToolsLocator
+				.getDynObjectManager().createDynObject(
+						registerDynClass());
+	}
+
+	@SuppressWarnings("unchecked")
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		super.loadFromState(state);
+		DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager();
+
+		List<RasterDataParameters> parameters = state.getList("parameters");
+		for (int i = 0; i < parameters.size(); i++) {
+			try {
+				DefaultRasterStore dSet = new DefaultRasterStore();
+				AbstractRasterProvider provider = (AbstractRasterProvider)dataManager.createProvider(dSet, parameters.get(i));
+				addProvider(provider);
+			} catch (InitializeException e) {
+				throw new PersistenceException(e);
+			} catch (ProviderNotRegisteredException e) {
+				throw new PersistenceException(e);
+			}
+		}
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		List<RasterProvider> provList = getProviders();
+		List<RasterDataParameters> rasterDataParametersList = new ArrayList<RasterDataParameters>();
+		for (int j = 0; j < provList.size(); j++) {
+			rasterDataParametersList.add(provList.get(j).getDataParameters());
+		}
+
+		state.set("parameters", rasterDataParametersList);
+	}
+
+	public static DynStruct registerDynClass() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.getDefinition("MultiFileDataParameters_Persistent");
+		if( definition == null ) {
+			definition = manager.addDefinition(
+					MultiFileDataParametersImpl.class,
+					"MultiFileDataParameters_Persistent",
+					"MultiFileDataParameters Persistent",
+					null,
+					null
+			);
+			AbstractRasterDataParameters.registerDynClass(definition);
+		}
+
+		definition.addDynFieldList("parameters")
+		.setClassOfItems(RasterDataParameters.class)
+		.setMandatory(false);
+
+		return definition;
+	}
+
+	public void removeAllProviders() {
+		getProviders().clear();
+		getParams().clear();
+	}
+
+	public boolean hasProviders() {
+		return getProviders().size() > 0;
+	}
+
+	public void removeProvider(URI uri) {
+		if(getProviders() != null) {
+			List<RasterProvider> provList = getProviders();
+			List<RasterDataParameters> paramList = getParams();
+			for (int i = 0; i < provList.size(); i++) {
+				RasterProvider rProv = provList.get(i);
+				if(rProv.getURIOfFirstProvider().compareTo(uri) == 0) {
+					provList.remove(i);
+					paramList.remove(i);
+					return;
+				}
+			}
+		}
+	}
+
+	public void addProviderNotTiled(DataStoreProvider provider) {
+		if(provider instanceof RasterProvider) {
+			RasterProvider prov = (RasterProvider)provider;
+			if(!prov.isTiled()) {
+				addToList(prov);
+			}
+		}
+	}
+
+	public void setFirstProvider(DataStoreProvider provider) {
+		if(provider instanceof RasterProvider) {
+			RasterProvider prov = (RasterProvider)provider;
+			if(getProviders() != null) {
+				getProviders().set(0, prov);
+				getParams().set(0, prov.getDataParameters());
+			}
+		}
+	}
+
+	public void addProvider(DataStoreProvider provider) {
+		if(provider instanceof RasterProvider) {
+			RasterProvider prov = (RasterProvider)provider;
+			addToList(prov);
+		}
+	}
+
+	public void addProvider(RasterDataStore rasterDataStore) {
+		if(rasterDataStore instanceof DefaultRasterStore) {
+			RasterProvider prov = (RasterProvider)((DefaultRasterStore)rasterDataStore).getProvider();
+			addToList(prov);
+		}
+	}
+
+	private void addToList(RasterProvider prov) {
+		addProviderToList(prov);
+		addParamToList(prov);
+	}
+
+	@SuppressWarnings("unchecked")
+	private List<RasterDataParameters> getParams() {
+		return (List<RasterDataParameters>)getDynValue("parameters");
+	}
+
+	private void addParamToList(RasterProvider prov) {
+		List<RasterDataParameters> paramList = getParams();
+		if(paramList == null) {
+			paramList = new ArrayList<RasterDataParameters>();
+			paramList.add(prov.getDataParameters());
+			setDynValue("parameters", paramList);
+		} else {
+			paramList.add(prov.getDataParameters());
+		}
+	}
+
+	public List<RasterProvider> getProviders() {
+		return this.providerList;
+	}
+
+	private void addProviderToList(RasterProvider prov) {
+		List<RasterProvider> provList = getProviders();
+		if(provList == null) {
+			provList = new ArrayList<RasterProvider>();
+			provList.add(prov);
+			setDynValue("parameters", provList);
+		} else {
+			provList.add(prov);
+		}
+	}
+
+
+	public void setProviders(ArrayList<RasterProvider> provList) {
+		List<RasterDataParameters> paramsList = new ArrayList<RasterDataParameters>();
+		for (int i = 0; i < provList.size(); i++) {
+			paramsList.add(provList.get(i).getDataParameters());
+		}
+		setDynValue("parameters", paramsList);
+		providerList = provList;
+	}
+
+	public String getDataStoreName() {
+		return MultiFileProvider.NAME;
+	}
+
+	public String getDescription() {
+		return MultiFileProvider.DESCRIPTION;
+	}
+
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileDataParametersImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/DefaultMultiFileIOLibrary.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/DefaultMultiFileIOLibrary.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/DefaultMultiFileIOLibrary.java	(revision 8080)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.multifile.io;
+
+import org.gvsig.fmap.dal.DALFileLibrary;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.Library;
+import org.gvsig.tools.library.LibraryException;
+/**
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class DefaultMultiFileIOLibrary extends AbstractLibrary {	
+
+	@SuppressWarnings("deprecation")
+	public DefaultMultiFileIOLibrary() {
+		super(DefaultMultiFileIOLibrary.class,Library.TYPE.IMPL);
+		require(ToolsLibrary.class);
+		require(DALLibrary.class);
+		require(DALFileLibrary.class);
+	}
+	
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		MultiFileServerExplorerParameters.registerDynClass();
+		MultiFileDataParametersImpl.registerDynClass();
+		MultiFileProvider.register();
+	}
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/DefaultMultiFileIOLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormatSerializer.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormatSerializer.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormatSerializer.java	(revision 8080)
@@ -0,0 +1,230 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.multifile.io;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.text.ParseException;
+
+import org.gvsig.fmap.dal.coverage.exception.ParsingException;
+import org.gvsig.raster.impl.store.rmf.ClassSerializer;
+import org.gvsig.raster.impl.store.rmf.RmfBlocksManager;
+import org.kxml2.io.KXmlParser;
+import org.xmlpull.v1.XmlPullParserException;
+/**
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class MultiFileFormatSerializer extends ClassSerializer {
+	//TAGS
+	public static final String MAIN_TAG          = "MultiFileFormat";
+	public static final String URIS              = "URIs";
+	public static final String URI               = "URI";
+	public static final String NAME              = "Name";
+	private MultiFileFormat   multiFileFormat    = null;
+
+	/**
+	 * @param timeSeriesFormat
+	 */
+	public MultiFileFormatSerializer(MultiFileFormat timeSeriesFormat) {
+		this.multiFileFormat = timeSeriesFormat;
+	}
+
+ 	/**
+	 * Parsers a date list
+	 * @param tInfo
+	 * @param parser
+	 * @param xml
+ 	 * @param parseableTag
+	 * @param tag
+	 * @throws XmlPullParserException
+	 * @throws IOException
+	 * @throws ParsingException
+	 * @throws NumberFormatException
+	 * @throws ParseException
+	 */
+	public void parseURIs(KXmlParser parser, String xml, String parseableTag) throws XmlPullParserException, IOException, NumberFormatException, ParsingException, ParseException  {
+		boolean end = false;
+		boolean init = false;
+		boolean readFile = false;
+		int tag = parser.next();
+		while (!end) {
+			switch (tag) {
+				case KXmlParser.END_DOCUMENT:
+					return;
+				case KXmlParser.START_TAG:
+					if (parser.getName().compareTo(parseableTag) == 0) {
+						init = true;
+					}
+					if(init) {
+						if (parser.getName().compareTo(URI) == 0) {
+							readFile = true;
+						}
+					}
+					break;
+				case KXmlParser.END_TAG:
+					if (parser.getName().compareTo(parseableTag) == 0)
+						end = true;
+					break;
+				case KXmlParser.TEXT:
+					if(readFile) {
+						String file = parser.getText();
+						multiFileFormat.addFile(new File(file));
+						readFile = false;
+					}
+					break;
+			}
+			if (!end)
+				tag = parser.next();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.raster.dataset.io.rmf.IRmfBlock#read(java.lang.String)
+	 */
+	public void read(String xml) throws ParsingException {
+		if(multiFileFormat == null)
+			multiFileFormat = new MultiFileFormat();
+		else {
+			multiFileFormat.clean();
+		}
+		boolean init = false;
+		boolean end = false;
+
+		KXmlParser parser = new KXmlParser();
+		Reader reader = new StringReader(xml);
+		try {
+			parser.setInput(reader);
+		} catch (XmlPullParserException e) {
+			throw new ParsingException(xml);
+		}
+		try {
+			int tag = parser.nextTag();
+
+			if ( parser.getEventType() != KXmlParser.END_DOCUMENT ){
+				parser.require(KXmlParser.START_TAG, null, MAIN_TAG);
+				while(tag != KXmlParser.END_DOCUMENT) {
+					switch(tag) {
+						case KXmlParser.START_TAG:
+							if (parser.getName().compareTo(MAIN_TAG) == 0)
+								init = true;
+							break;
+						case KXmlParser.END_TAG:
+							if(parser.getName().compareTo(MAIN_TAG) == 0)
+								end = true;
+							break;
+						case KXmlParser.TEXT:
+							if(init) {
+								String name = parserString(parser, NAME, null);
+								multiFileFormat.setName(name);
+								parseURIs(parser, xml, URIS);
+								init = false;
+							}
+							break;
+					}
+					if(end)
+						break;
+					tag = parser.next();
+				}
+			}
+
+		} catch (XmlPullParserException e) {
+			throw new ParsingException(xml);
+		} catch (IOException e) {
+			throw new ParsingException(xml);
+		} catch (NumberFormatException e) {
+			throw new ParsingException(xml);
+		} catch (ParseException e) {
+			throw new ParsingException(xml);
+		}
+	}
+
+	/**
+	 * Writes a MultiFileFormat to disk
+	 * @param multiFileFormat
+	 * @param fileName
+	 * @param file
+	 * @throws IOException
+	 */
+	public static void write(MultiFileFormat multiFileFormat, String fileName) throws IOException {
+		File file = new File(fileName);
+		file.createNewFile();
+		FileWriter writer = new FileWriter(file);
+		MultiFileFormatSerializer serializer = new MultiFileFormatSerializer(multiFileFormat);
+		writer.write(serializer.write());
+		writer.close();
+	}
+
+	/**
+	 * Reads a TimeSeriesFormat from disk
+	 * @param timeSeriesFormat
+	 * @param file
+	 * @return MultiFileFormat
+	 * @throws IOException
+	 * @throws ParsingException
+	 */
+	public static MultiFileFormat read(MultiFileFormat timeSeriesFormat, String file) throws IOException, ParsingException {
+		RmfBlocksManager manager = new RmfBlocksManager(file);
+		MultiFileFormatSerializer serializer = new MultiFileFormatSerializer(timeSeriesFormat);
+		manager.addClient(serializer);
+		manager.read(null);
+		return timeSeriesFormat;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.raster.dataset.io.rmf.IRmfBlock#write()
+	 */
+	public String write() {
+		StringBuffer b = new StringBuffer();
+		b.append("<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n");
+		b.append("<" + MAIN_TAG + ">\n");
+		putProperty(b, NAME, multiFileFormat.getName(), 2);
+
+		b.append("\t\t<" + URIS + ">\n");
+		for (int i = 0; i < multiFileFormat.getNumberOfFiles(); i++) {
+			putProperty(b, URI, multiFileFormat.getPathToFile(i), 3);
+		}
+		b.append("\t\t</" + URIS + ">\n");
+		b.append("</" + MAIN_TAG + ">\n");
+		return b.toString();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.raster.dataset.io.rmf.IRmfBlock#getResult()
+	 */
+	public Object getResult() {
+		return multiFileFormat;
+	}
+
+	/*
+	 *  (non-Javadoc)
+	 * @see org.gvsig.raster.dataset.io.rmf.IRmfBlock#getMainTag()
+	 */
+	public String getMainTag() {
+		return MAIN_TAG;
+	}
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormatSerializer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileServerExplorer.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileServerExplorer.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileServerExplorer.java	(revision 8080)
@@ -0,0 +1,217 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.raster.multifile.io;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.commons.io.FilenameUtils;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataServerExplorerParameters;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.exception.RemoveException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
+import org.gvsig.fmap.dal.spi.DataServerExplorerProvider;
+import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
+import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters;
+
+/**
+ * Explorer for a Multifile
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class MultiFileServerExplorer extends AbstractFilesystemServerExplorerProvider implements DataServerExplorerProvider  {
+
+	/**
+	 *
+	 */
+	public MultiFileServerExplorer() {
+
+	}
+
+	/**
+	 * @param parameters
+	 * @param services
+	 * @throws InitializeException
+	 */
+	public MultiFileServerExplorer(
+			MultiFileServerExplorerParameters parameters,
+			DataServerExplorerProviderServices services)
+			throws InitializeException {
+		System.out.println();
+	}
+
+        @Override
+        public DataStoreParameters get(String string) throws DataException {
+            return null;
+        }
+
+	public String getDataStoreProviderName() {
+		return MultiFileProvider.NAME;
+	}
+
+	public String getDescription() {
+		return MultiFileProvider.DESCRIPTION;
+	}
+
+	/**
+	 * @return the DataStoreParameters
+	 */
+	public DataStoreParameters getStoreParameters() {
+		DataManager manager = DALLocator.getDataManager();
+		try {
+			return  manager.createStoreParameters(this.getDataStoreProviderName());
+		} catch (InitializeException e) {
+			e.printStackTrace();
+		} catch (ProviderNotRegisteredException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	public List<?> getDataStoreProviderNames() {
+		return null;
+	}
+
+	public String getProviderName() {
+		return MultiFileProvider.NAME;
+	}
+
+	public DataServerExplorerProviderServices getServerExplorerProviderServices() {
+		return null;
+	}
+
+	public boolean canCreate() {
+		return false;
+	}
+
+	public boolean canCreate(NewDataStoreParameters parameters) {
+		return false;
+	}
+
+	public void create(NewDataStoreParameters parameters, boolean overwrite)
+			throws CreateException {
+		throw new UnsupportedOperationException();
+	}
+
+	public NewDataStoreParameters getCreateParameters() throws DataException {
+		return null;
+	}
+
+	public void initialize(
+			FilesystemServerExplorerProviderServices serverExplorer) {
+	}
+
+	public boolean accept(File pathname) {
+		return RasterLocator.getManager().getProviderServices().isExtensionSupported(
+				pathname.getAbsolutePath(),
+				MultiFileProvider.class);
+	}
+
+	public void remove(DataStoreParameters parameters) throws RemoveException {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean add(String provider, NewDataStoreParameters parameters,
+			boolean overwrite) throws DataException {
+		return false;
+	}
+
+	public boolean canAdd() {
+		return false;
+	}
+
+	public boolean canAdd(String storeName) throws DataException {
+		return false;
+	}
+
+	public NewDataStoreParameters getAddParameters(String storeName)
+			throws DataException {
+		return null;
+	}
+
+	/**
+	 * Creates store parameters from the file and returns it.
+	 * @param file
+	 * @return the DataStoreParameters
+	 * @throws DataException
+	 */
+	public DataStoreParameters getParameters(File file) throws DataException {
+		DataManager manager = DALLocator.getDataManager();
+		AbstractRasterFileDataParameters params = (AbstractRasterFileDataParameters) manager
+				.createStoreParameters(this.getDataStoreProviderName());
+		params.setFile(file);
+		return params;
+	}
+
+	public DataServerExplorerParameters getParameters() {
+		return null;
+	}
+
+	public List<?> list() throws DataException {
+		return null;
+	}
+
+	public List<?> list(int mode) throws DataException {
+		return null;
+	}
+
+	public void dispose() {
+	}
+
+	public int getMode() {
+		return DataServerExplorer.MODE_RASTER;
+	}
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.dal.DataServerExplorer#getResourcePath(org.gvsig.fmap.dal.DataStore, java.lang.String)
+     */
+    @Override
+    public File getResourcePath(DataStore dataStore, String resourceName) throws DataException {
+        String rootPathName = getResourceRootPathName(dataStore);
+        if (rootPathName == null) {
+            return null;
+        }
+        File f = new File(FilenameUtils.getPathNoEndSeparator(rootPathName),resourceName);
+        if( f.exists() ) {
+            return f;
+        }
+        return new File(rootPathName + "." + resourceName);
+    }
+
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileServerExplorer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormat.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormat.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormat.java	(revision 8080)
@@ -0,0 +1,115 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.multifile.io;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+/**
+ * MultiFileFormat information
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class MultiFileFormat {
+	public ArrayList<File>   fileList                       = new ArrayList<File>();
+	private String           name                           = null;
+
+	/**
+	 * Gets the name of this serial
+	 * @return String
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Sets the name of this serie
+	 * @param name
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Gets the number of files of this serial
+	 * @return int
+	 */
+	public int getNumberOfFiles() {
+		return fileList.size();
+	}
+
+	/**
+	 * Gets the path of the file in the selected position
+	 * @param file
+	 * @return String
+	 */
+	public String getPathToFile(int file) {
+		return fileList.get(file).getAbsolutePath();
+	}
+
+	/**
+	 * Adds a file to the list
+	 * @param file
+	 */
+	public void addFile(File file) {
+		fileList.add(file);
+	}
+
+	/**
+	 * Cleans the list of files
+	 */
+	public void clean() {
+		fileList.clear();
+		name = null;
+	}
+
+	/**
+	 * @param fileName
+	 * @param path
+	 * @param uriList
+	 * @return String
+	 * @throws IOException
+	 */
+	public static String saveMultiFileFormat(String fileName, String path, ArrayList<File> uriList) throws IOException {
+		path = path + File.separator + fileName + ".mff";
+
+		MultiFileFormat format = new MultiFileFormat();
+		for (int i = 0; i < uriList.size(); i++) {
+			format.addFile(uriList.get(i));
+		}
+		format.setName(fileName);
+
+		format.write(path);
+		return path;
+	}
+
+	/**
+	 * Writes a MultiFileFormat to disk
+	 * @param fileName
+	 * @param file
+	 * @throws IOException
+	 */
+	public void write(String fileName) throws IOException {
+		MultiFileFormatSerializer.write(this, fileName);
+	}
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormat.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileProvider.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileProvider.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileProvider.java	(revision 8080)
@@ -0,0 +1,907 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.multifile.io;
+
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.DALFileLocator;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.datastruct.BandList;
+import org.gvsig.fmap.dal.coverage.datastruct.Extent;
+import org.gvsig.fmap.dal.coverage.exception.BandAccessException;
+import org.gvsig.fmap.dal.coverage.exception.BandNotFoundInListException;
+import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException;
+import org.gvsig.fmap.dal.coverage.exception.FileNotSupportedException;
+import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException;
+import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException;
+import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException;
+import org.gvsig.fmap.dal.coverage.exception.ParsingException;
+import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
+import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
+import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters;
+import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation;
+import org.gvsig.fmap.dal.coverage.store.props.ColorTable;
+import org.gvsig.fmap.dal.coverage.store.props.HistogramComputer;
+import org.gvsig.fmap.dal.coverage.store.props.Statistics;
+import org.gvsig.fmap.dal.coverage.util.ProviderServices;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+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.DataManagerProviderServices;
+import org.gvsig.fmap.dal.spi.DataStoreProvider;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.raster.cache.tile.provider.TileServer;
+import org.gvsig.raster.impl.buffer.SpiRasterQuery;
+import org.gvsig.raster.impl.datastruct.BandListImpl;
+import org.gvsig.raster.impl.datastruct.DatasetBandImpl;
+import org.gvsig.raster.impl.datastruct.ExtentImpl;
+import org.gvsig.raster.impl.provider.AbstractRasterProvider;
+import org.gvsig.raster.impl.provider.RasterProvider;
+import org.gvsig.raster.impl.provider.tile.FileTileServer;
+import org.gvsig.raster.impl.store.DefaultRasterStore;
+import org.gvsig.raster.impl.store.DefaultStoreFactory;
+import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation;
+import org.gvsig.raster.impl.store.properties.DataStoreTransparency;
+import org.gvsig.raster.impl.store.properties.MultiProviderHistogramComputer;
+import org.gvsig.raster.impl.store.properties.MultiProviderStatistics;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.locator.LocatorException;
+/**
+ * A data provider for a multiband image readed from different files
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class MultiFileProvider extends AbstractRasterProvider {
+	public static String                     NAME                     = "Multifile Raster";
+	public static String                     DESCRIPTION              = "Multifile Raster Support";
+	public final String                      METADATA_DEFINITION_NAME = NAME;
+	private Extent                           viewRequest              = null;
+	private TileServer                       tileServer               = null;
+	private boolean                          open                     = false;
+
+    private DataStoreTransparency            fileTransparency         = null;
+    private static final Logger              logger                   = LoggerFactory.getLogger(MultiFileProvider.class);
+    protected static String[]                formatList               = null;
+
+	/**
+	 *
+	 */
+	public static void register() {
+		DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager();
+		registerFormats();
+
+		if (dataman != null && !dataman.getStoreProviders().contains(NAME)) {
+			dataman.registerStoreProvider(NAME,
+					MultiFileProvider.class, MultiFileDataParametersImpl.class);
+		}
+
+		if(DALFileLocator.getFilesystemServerExplorerManager() != null)
+			DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
+					NAME, DESCRIPTION,
+					MultiFileServerExplorer.class);
+
+		if (!dataman.getExplorerProviders().contains(NAME)) {
+			dataman.registerExplorerProvider(NAME, MultiFileServerExplorer.class, MultiFileServerExplorerParameters.class);
+		}
+
+		dataman.registerStoreFactory(NAME, DefaultStoreFactory.class);
+	}
+
+	private static void registerFormats() {
+		formatList      = new String[] {
+				"mff"};
+		for (int i = 0; i < formatList.length; i++)
+			RasterLocator.getManager().getProviderServices().addFormat(
+					formatList[i],
+					MultiFileProvider.class);
+	}
+
+	/**
+	 *
+	 */
+	public MultiFileProvider() {
+	}
+
+	/**
+	 * Opens the dataset.
+	 * @param params
+	 * @param proj Projection
+	 * @param fName File name
+	 * @throws NotSupportedExtensionException
+	 * @throws OpenException
+     * @deprecated use {@link #MultiFileProvider(URI)}, this constructor will be removed in gvSIG 2.5
+	 */
+	public MultiFileProvider(String params) throws NotSupportedExtensionException, OpenException {
+		super(params);
+        logger.info("Deprecated use of MultiFileProvider constructor");
+		if(params instanceof String) {
+			MultiFileDataParameters p = new MultiFileDataParametersImpl();
+			URI uriObj;
+            try {
+                uriObj = new URI((String)params);
+            } catch (URISyntaxException e) {
+                throw new OpenException("Can't create uri from "+(String)params, e);
+            }
+			p.setURI(uriObj);
+			super.init(p, null, ToolsLocator.getDynObjectManager()
+					.createDynObject(
+							MetadataLocator.getMetadataManager().getDefinition(
+									DataStore.METADATA_DEFINITION_NAME)));
+			init(p, null);
+		}
+	}
+
+	 /**
+     * Opens the dataset.
+	 * @param uri
+     * @param proj Projection
+     * @param fName File name
+     * @throws NotSupportedExtensionException
+	 * @throws OpenException
+     */
+    public MultiFileProvider(URI uri) throws NotSupportedExtensionException, OpenException {
+        super(uri);
+        MultiFileDataParameters p = new MultiFileDataParametersImpl();
+        p.setURI(uri);
+        super.init(
+            p,
+            null,
+            ToolsLocator.getDynObjectManager().createDynObject(
+                MetadataLocator.getMetadataManager().getDefinition(DataStore.METADATA_DEFINITION_NAME)));
+        init(p, null);
+    }
+
+    /**
+     * @param params
+     * @param storeServices
+     * @throws NotSupportedExtensionException
+     * @throws OpenException
+     */
+    public MultiFileProvider(MultiFileDataParametersImpl params,
+			DataStoreProviderServices storeServices) throws NotSupportedExtensionException, OpenException {
+		super(params, storeServices, ToolsLocator.getDynObjectManager()
+				.createDynObject(
+						MetadataLocator.getMetadataManager().getDefinition(
+								DataStore.METADATA_DEFINITION_NAME)));
+		init(params, storeServices);
+	}
+
+	/**
+	 * Build file references
+	 * @param params
+	 * @param storeServices
+	 * @param proj Projection
+	 * @param param Load parameters
+	 * @throws NotSupportedExtensionException
+	 * @throws OpenException
+	 */
+	public void init(MultiFileDataParameters params,
+			DataStoreProviderServices storeServices) throws NotSupportedExtensionException, OpenException {
+
+		openFromMff();
+
+		uri = getParameters().getURI();
+		setParam(storeServices, params);
+
+		try {
+			setFirstProviderToNotTiled();
+		} catch (InvalidSourceException e1) {
+			throw new OpenException(e1.getMessage(), e1);
+		}
+
+		super.init();
+
+		try {
+			loadFromRmf(getRmfBlocksManager());
+		} catch (ParsingException e) {
+			logger.debug("Problems reading from RMF", e);
+		}
+
+		open = true;
+	}
+
+	/**
+	 * Open from a .mff file.
+	 * This method loads all providers and adds these to the parameters
+	 * @throws OpenException
+	 */
+	private void openFromMff() throws OpenException {
+		URI uriParam = getParameters().getURI();
+        if (uriParam != null) {
+            File fileFromUriParam = new File(uriParam);
+            if (fileFromUriParam.exists()) {
+                boolean loadedProviders = true;
+                if (getParameters().hasProviders()) {
+                    // solo se considera que est�n todos los providers cargados
+                    // si existen y est�n open,
+                    // sino se leer�n de disco
+                    for (int i = 0; i < getParameters().getProviders().size(); i++) {
+                        if (!getParameters().getProviders().get(i).isOpen())
+                            loadedProviders = false;
+                    }
+                } else
+                    loadedProviders = false;
+
+                if (loadedProviders)
+                    return;
+
+                try {
+                    if (getParameters().hasProviders())
+                        getParameters().removeAllProviders();
+                    MultiFileFormat multiFileFormat = new MultiFileFormat();
+                    multiFileFormat = MultiFileFormatSerializer.read(multiFileFormat, fileFromUriParam.getAbsolutePath());
+                    for (int i = 0; i < multiFileFormat.getNumberOfFiles(); i++) {
+                        try {
+                            File file = new File(multiFileFormat.getPathToFile(i));
+                            if (file.exists()) {
+                                RasterProvider prov = loadProvider(multiFileFormat.getPathToFile(i), storeServices);
+                                getParameters().addProvider(prov);
+                            }
+                        } catch (ProviderNotRegisteredException e) {
+                            throw new OpenException("A provider can't be loaded", e);
+                        } catch (InitializeException e) {
+                            throw new OpenException("A provider can't be initialized", e);
+                        }
+                    }
+                } catch (IOException e1) {
+                    throw new OpenException("File .mff can't be read", e1);
+                } catch (ParsingException e1) {
+                    throw new OpenException("File .mff can't be parsed", e1);
+                }
+            }
+        }
+	}
+
+	/**
+	 * Loads the specific provider
+	 * @param file
+	 * @return
+	 * @throws NotSupportedExtensionException
+	 * @throws FileNotSupportedException
+	 */
+	@SuppressWarnings("unchecked")
+	private RasterProvider loadProvider(String file, DataStoreProviderServices storeServices) throws ProviderNotRegisteredException, InitializeException {
+		DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager();
+		DataStoreProvider prov = null;
+
+		if(file != null) {
+			//We have to locate a provider's name which manages the selected file
+			//A FilesystemServerExplorer will give a getProviderNames service
+			FilesystemServerExplorerParameters paramsExplorer = (FilesystemServerExplorerParameters)dataManager.createServerExplorerParameters(FilesystemServerExplorer.NAME);
+			FilesystemServerExplorer serverExplorer = null;
+			try {
+				paramsExplorer.setRoot(File.separator);
+				serverExplorer = (FilesystemServerExplorer)dataManager.openServerExplorer(FilesystemServerExplorer.NAME, paramsExplorer);
+			} catch (ValidateDataParametersException e) {
+				throw new InitializeException(e);
+			}
+			File f = new File(file);
+			//Gets the list of provider's name to manage the file
+			List<String> provName = serverExplorer.getProviderNameList(f);
+			if(provName.size() > 0) {
+				for (int i = 0; i < provName.size(); i++) {
+					//Gets the first provider what is not a TileProvider
+					if(provName.get(i).compareTo("Tile Store") != 0) {
+						DataStoreParameters newparams = dataManager.createStoreParameters(provName.get(i));
+						((FilesystemStoreParameters)newparams).setFile(f);
+						prov = dataManager.createProvider(storeServices, newparams);
+					}
+				}
+			}
+		}
+
+		if(prov != null && prov instanceof RasterProvider) {
+			if(((RasterProvider)prov).isRotated())
+				throw new InitializeException("Rotation not supported tiling files", new Throwable());
+
+			return (RasterProvider)prov;
+		}
+
+		return null;
+	}
+
+	/**
+	 * Checks if the new file is compatible with the old one
+	 * @param file
+	 * @return
+	 * @throws LocatorException
+	 * @throws NotSupportedExtensionException
+	 * @throws RasterDriverException
+	 * @throws CloseException
+	 */
+	private boolean checkNewProvider(RasterProvider p) {
+		Rectangle2D extentOrigin = getExtent().toRectangle2D();
+
+		Extent extentNewFile = p.getExtent();
+
+		// Comprobamos que el extent y tama�o del fichero a�adido sea igual al
+		// fichero original. Si no es as� no abrimos la capa y mostramos un aviso
+
+		double widthNewFile = (extentNewFile.getMax().getX() - extentNewFile.getMin().getX());
+		double heightNewFile = (extentNewFile.getMax().getY() - extentNewFile.getMin().getY());
+
+		if ((widthNewFile - extentOrigin.getWidth()) > 1.0 || (widthNewFile - extentOrigin.getWidth()) < -1.0 || (heightNewFile - extentOrigin.getHeight()) > 1.0
+				|| (heightNewFile - extentOrigin.getHeight()) < -1.0) {
+			return false;
+		}
+
+		if ((extentNewFile.getMax().getX() - extentNewFile.getMin().getX()) != extentOrigin.getWidth()
+				|| (extentNewFile.getMax().getY() - extentNewFile.getMin().getY()) != extentOrigin.getHeight()) {
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * @return MultiFileDataParameters
+	 */
+	public MultiFileDataParameters getParameters() {
+		try {
+			return (MultiFileDataParameters)parameters;
+		} catch (ClassCastException e) {
+			return null;
+		}
+	}
+
+	public RasterProvider load() {
+		return this;
+	}
+
+	public int getBandCount() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		int bandCount = 0;
+		for (int i = 0; i < providerList.size(); i++) {
+			bandCount += providerList.get(i).getBandCount();
+		}
+		return bandCount;
+	}
+
+	public int[] getDataType() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		int[] datatypes = new int[getBandCount()];
+		int k = 0;
+		for (int i = 0; i < providerList.size(); i++) {
+			int[] dtByProv = providerList.get(i).getDataType();
+			for (int j = 0; j < dtByProv.length; j++) {
+				datatypes[k] = dtByProv[j];
+				k++;
+			}
+		}
+		return datatypes;
+	}
+
+	public URI[] getURIByProvider() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		URI[] uris = new URI[providerList.size()];
+		for (int i = 0; i < uris.length; i++) {
+			uris[i] = providerList.get(i).getURIOfFirstProvider();
+		}
+		return uris;
+	}
+
+	public int getBandPositionByProvider(int band) {
+		return getSubBandByBandNumber(band)[1];
+	}
+
+	public URI getURIOfFirstProvider() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		return providerList.get(0).getURIOfFirstProvider();
+	}
+
+
+	public Extent getExtent() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		if(providerList != null && providerList.size() > 0)
+			return providerList.get(0).getExtent();
+		return null;
+	}
+
+	public AffineTransform getAffineTransform() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		return providerList.get(0).getAffineTransform();
+	}
+
+	public void setAffineTransform(AffineTransform t) {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		for (int i = 0; i < providerList.size(); i++) {
+			providerList.get(i).setAffineTransform(t);
+		}
+	}
+
+	public int getInternalProviderCount() {
+		return getParameters().getProviders().size();
+	}
+
+	public RasterProvider getInternalProvider(int i) {
+		return getParameters().getProviders().get(i);
+	}
+
+	public int[] getBandCountByProvider() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		int[] bc = new int[providerList.size()];
+		for (int i = 0; i < bc.length; i++) {
+			bc[i] = providerList.get(i).getBandCount();
+		}
+		return bc;
+	}
+
+	public long[] getFileSizeByProvider() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		long[] fs = new long[providerList.size()];
+		for (int i = 0; i < fs.length; i++) {
+			fs[i] = ((AbstractRasterProvider)providerList.get(i)).getFileSize();
+		}
+		return fs;
+	}
+
+	public Point2D rasterToWorld(Point2D pt) {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		return providerList.get(0).rasterToWorld(pt);
+	}
+
+	public Point2D worldToRaster(Point2D pt) {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		return providerList.get(0).worldToRaster(pt);
+	}
+
+	public boolean isInside(Point2D p){
+		List<RasterProvider> providerList = getParameters().getProviders();
+		return providerList.get(0).isInside(p);
+	}
+
+	public double getCellSize() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		return providerList.get(0).getCellSize();
+	}
+
+	public Statistics getStatistics() {
+		if(stats == null || (stats instanceof MultiProviderStatistics &&
+				((MultiProviderStatistics)stats).getNumberOfProviders() != getParameters().getProviders().size())) {
+			List<RasterProvider> providerList = getParameters().getProviders();
+			stats = new MultiProviderStatistics(providerList, this);
+		}
+
+		return stats;
+	}
+
+	public HistogramComputer getHistogramComputer() {
+		if(histogram == null ||
+			(histogram instanceof MultiProviderHistogramComputer &&
+			((MultiProviderHistogramComputer)histogram).getNumberOfProviders() != getParameters().getProviders().size())) {
+			histogram = new MultiProviderHistogramComputer(this);
+		}
+
+		return histogram;
+	}
+
+	/**
+	 * A multiband provider doesn't have a color table because this will have
+	 * more than one band.
+	 */
+	public ColorTable getColorTable() {
+		return null;
+	}
+
+	public boolean isOpen() {
+		return open;
+	}
+
+	public void close() {
+	}
+
+	public URI translateURI(URI uri) {
+		return uri;
+	}
+
+	/**
+	 * Asigna el extent de la vista actual. existe un fichero .rmf debemos hacer una transformaci�n
+	 * de la vista asignada ya que la petici�n viene en coordenadas del fichero .rmf y la vista (v)
+	 * ha de estar en coordenadas del fichero.
+	 */
+	public void setView(Extent e) {
+		viewRequest = new ExtentImpl(e);
+	}
+
+	public Extent getView() {
+		return viewRequest;
+	}
+
+	public double getWidth() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		if(providerList != null && providerList.size() > 0) {
+			return providerList.get(0).getWidth();
+		}
+		return 0;
+	}
+
+	public double getHeight() {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		if(providerList != null && providerList.size() > 0) {
+			return providerList.get(0).getHeight();
+		}
+		return 0;
+
+	}
+
+	public Object readBlock(int pos, int blockHeight, double scale)
+		throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException {
+		return null;
+	}
+
+	/**
+	 * Gets a number of provider and the band of this provider
+	 * @param band
+	 * @return
+	 */
+	private int[] getSubBandByBandNumber(int band) {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		int[] res = new int[2];
+		int acum = 0;
+		for (int i = 0; i < providerList.size(); i++) {
+			acum += providerList.get(i).getBandCount();
+			if(acum > band) {
+				res[0] = i;
+				int aux = (acum - providerList.get(i).getBandCount());
+				res[1] = band - aux;
+				return res;
+			}
+		}
+		return res;
+	}
+
+	@Override
+	public void loadBuffer(SpiRasterQuery q)
+			throws ProcessInterruptedException, RasterDriverException {
+		List<RasterProvider> providerList = getParameters().getProviders();
+
+		for (int i = 0; i < providerList.size(); i++) {
+			SpiRasterQuery query = (SpiRasterQuery)q.clone();
+			BandList bandListByFile = createBandListByProvider(q.getBandList(), providerList.get(i));
+			query.setBandList(bandListByFile);
+			providerList.get(i).getDataSet(q);
+		}
+
+		/*for (int i = 0; i < providerList.size(); i++) {
+			DefaultRasterStore store = new DefaultRasterStore();
+			store.setProvider(providerList.get(i));
+			RasterQuery query = ((DefaultRasterQuery)q).clone();
+			BandList bandListByFile = createBandListByProvider(q.getBandList(), providerList.get(i));
+			query.set
+			try {
+				store.query((RasterQuery)q);
+			} catch (QueryException e) {
+				throw new RasterDriverException("Error in query to the provider " + i, e);
+			}
+		}*/
+	}
+
+	public Object getData(int x, int y, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
+		int[] sub = getSubBandByBandNumber(band);
+		RasterProvider prov = getParameters().getProviders().get(sub[0]);
+		return prov.getData(x, y, sub[1]);
+	}
+
+
+	/*public Buffer getWindow(Extent extent, BandList bandList, Buffer rasterBuf, TaskStatus status)
+		throws ProcessInterruptedException, RasterDriverException {
+		providerList = getParameters().getProviders();
+
+		DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery();
+		q.setAreaOfInterest(extent);
+		q.setBandList(bandList);
+		q.setBuffer(rasterBuf);
+
+		for (int i = 0; i < providerList.size(); i++) {
+			rasterBuf = ((DefaultRasterProvider)providerList.get(i)).getDataSet(q);
+		}
+		return rasterBuf;
+	}*/
+
+	/*public Buffer getWindow(double ulx, double uly, double w, double h,
+			BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
+		providerList = getParameters().getProviders();
+
+		DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery();
+		q.setAreaOfInterest(ulx, uly, w, h);
+		q.setBandList(bandList);
+		q.setBuffer(rasterBuf);
+		q.setAdjustToExtent(adjustToExtent);
+
+		for (int i = 0; i < providerList.size(); i++) {
+			rasterBuf = ((DefaultRasterProvider)providerList.get(i)).getDataSet(q);
+		}
+		return rasterBuf;
+	}*/
+
+	/*public Buffer getWindow(Extent extent, int bufWidth, int bufHeight,
+			BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
+		providerList = getParameters().getProviders();
+
+		DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery();
+		q.setAreaOfInterest(extent, bufWidth, bufHeight);
+		q.setBuffer(rasterBuf);
+		q.setAdjustToExtent(adjustToExtent);
+
+		for (int i = 0; i < providerList.size(); i++) {
+			BandList bandListByFile = createBandListByProvider(bandList, providerList.get(i));
+			if(bandListByFile != null) {
+				q.setBandList(bandListByFile);
+				rasterBuf = ((DefaultRasterProvider)providerList.get(i)).getDataSet(q);
+			}
+		}
+		return rasterBuf;
+	}*/
+
+	/**
+	 * Creates a <code>BandList</code> for each provider of this <code>MultiFileProvider</code>.
+	 * When a request is made, the <code>BandList</code> is global for all files. A specific
+	 * <code>BandList</code> has to be built for each provider.
+	 * @param globalBandList
+	 * @param provider
+	 * @return
+	 */
+	private BandList createBandListByProvider(BandList globalBandList, RasterProvider provider) {
+		if(provider.isTiled()) {
+			//Si los proveedores que hay por debajo son tileados estos crear�n su propio buffer para escribir
+			//cada tile. Por ello no usar� el buffer que viene del store. Esto quiere decir que el BandList ha
+			//de ser distinto para que escriba bien en su buffer
+
+			//TODO: De momento no se permiten MultiFiles con proveedores tileados. Esto es porque
+			//los tiles crean su propio buffer y no escriben en el buffer creado en el Store
+
+		} else {
+			BandList bandListByFile = new BandListImpl();
+			String pathUriProvider = new File(provider.getURI()).getAbsolutePath();
+            for (int i = 0; i < provider.getBandCount(); i++) {
+				try {
+					bandListByFile.addBand(new DatasetBandImpl(pathUriProvider, i, provider.getDataType()[0], provider.getBandCount()));
+				} catch (BandNotFoundInListException e1) {
+				}
+			}
+
+			boolean areThereBandsToDraw = false;
+			for (int i = 0; i < provider.getBandCount(); i++) {
+				int[] bandsToDrawByProviderBand = globalBandList.getBufferBandToDraw(pathUriProvider, i);
+				if(bandsToDrawByProviderBand != null) {
+					areThereBandsToDraw = true;
+					for (int j = 0; j < bandsToDrawByProviderBand.length; j++) {
+						bandListByFile.getBand(i).addPositionToDrawInBuffer(bandsToDrawByProviderBand[j]);
+					}
+				}
+			}
+
+			if(areThereBandsToDraw)
+				return bandListByFile;
+		}
+		return null;
+	}
+
+	/*public Buffer getWindow(int x, int y, int w, int h,
+			BandList bandList, Buffer rasterBuf, TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
+		providerList = getParameters().getProviders();
+		DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery();
+		q.setAreaOfInterest(x, y, w, h);
+		q.setBandList(bandList);
+		q.setBuffer(rasterBuf);
+		for (int i = 0; i < providerList.size(); i++) {
+			rasterBuf = ((DefaultRasterProvider)providerList.get(i)).getDataSet(q);
+		}
+		return rasterBuf;
+	}*/
+
+	public int getBlockSize() {
+		return 0;
+	}
+
+	public ColorInterpretation getColorInterpretation() {
+		if(super.getColorInterpretation() == null) {
+			String[] cis = new String[getBandCount()];
+			for (int i = 0; i < cis.length; i++) {
+				if(i == 0)
+					cis[i] = ColorInterpretation.GRAY_BAND;
+				else
+					cis[i] = ColorInterpretation.UNDEF_BAND;
+			}
+			setColorInterpretation(new DataStoreColorInterpretation(cis));
+		}
+		return super.getColorInterpretation();
+	}
+
+	public DataStoreTransparency getTransparency() {
+		if(fileTransparency == null)
+			fileTransparency = new DataStoreTransparency(getColorInterpretation());
+		return fileTransparency;
+	}
+
+	/**
+	 * Informa de si el driver ha supersampleado en el �ltimo dibujado. Es el driver el que colocar�
+	 * el valor de esta variable cada vez que dibuja.
+	 * @return true si se ha supersampleado y false si no se ha hecho.
+	 */
+	public boolean isSupersampling() {
+		return false;
+	}
+
+	public int getOverviewCount(int band) throws BandAccessException, RasterDriverException {
+		if(band >= getBandCount())
+			throw new BandAccessException("Wrong band");
+		return 0;
+	}
+
+	public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException {
+		if (band >= getBandCount())
+			throw new BandAccessException("Wrong band");
+		return 0;
+	}
+
+	public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException {
+		if (band >= getBandCount())
+			throw new BandAccessException("Wrong band");
+		return 0;
+	}
+
+	public boolean isMultiFile() {
+		return true;
+	}
+
+	public boolean isOverviewsSupported() {
+		return true;
+	}
+
+	public boolean isReproyectable() {
+		return true;
+	}
+
+	public String getProviderName() {
+		return NAME;
+	}
+
+	public void setStatus(RasterProvider provider) {
+		if(provider instanceof MultiFileProvider) {
+			//Not implemented yet
+		}
+	}
+
+	public boolean isTimeSupported() {
+		return true;
+	}
+
+	public URI getURIByBand(int band) {
+		int[] sub = getSubBandByBandNumber(band);
+		RasterProvider prov = getParameters().getProviders().get(sub[0]);
+		return prov.getURIOfFirstProvider();
+	}
+
+	/**
+	 * @param file
+	 * @throws InvalidSourceException
+	 */
+	public void addFile(String file) throws InvalidSourceException {
+		ProviderServices provServ = RasterLocator.getManager().getProviderServices();
+		DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager();
+
+		setFirstProviderToNotTiled();
+
+		List<RasterDataParameters> storeParametersList = provServ.createParametersList(file);
+
+		for (int j = 0; j < storeParametersList.size(); j++) {
+			RasterProvider newFileProv;
+			try {
+				newFileProv = (RasterProvider)dataManager.createProvider(storeServices, storeParametersList.get(j));
+				if(!newFileProv.isTiled() && checkNewProvider(newFileProv)) {
+					getParameters().addProvider(newFileProv);
+				}
+			} catch (InitializeException e) {
+				throw new InvalidSourceException("", e);
+			} catch (ProviderNotRegisteredException e) {
+				throw new InvalidSourceException("", e);
+			}
+		}
+	}
+
+	private void setFirstProviderToNotTiled() throws InvalidSourceException {
+		List<RasterProvider> providerList = getParameters().getProviders();
+		if(providerList == null || providerList.size() <= 0 || !providerList.get(0).isTiled())
+			return;
+
+		//Si el primer proveedor es tileado se cambia a no tileado
+		DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager();
+		ProviderServices provServ = RasterLocator.getManager().getProviderServices();
+
+		RasterDataParameters firstDataParameters = providerList.get(0).getDataParameters();
+		URI uri = firstDataParameters.getURI();
+
+		List<RasterDataParameters> storeParametersList = provServ.createParametersList(new File(uri).getAbsolutePath());
+
+		for (int j = 0; j < storeParametersList.size(); j++) {
+			RasterProvider newFileProv;
+			try {
+				newFileProv = (RasterProvider)dataManager.createProvider(storeServices, storeParametersList.get(j));
+				if(!newFileProv.isTiled() && checkNewProvider(newFileProv)) {
+					getParameters().setFirstProvider(newFileProv);
+				}
+			} catch (InitializeException e) {
+				throw new InvalidSourceException("Error replacing the first provider", e);
+			} catch (ProviderNotRegisteredException e) {
+				throw new InvalidSourceException("Error replacing the first provider", e);
+			}
+		}
+	}
+
+	public void removeFile(File file) {
+		getParameters().removeProvider(file.toURI());
+	}
+
+	public TileServer getTileServer() {
+		if(tileServer == null) {
+			DefaultRasterStore store = new DefaultRasterStore();
+			store.setProvider(this);
+			tileServer = new FileTileServer(store);
+		}
+		return tileServer;
+	}
+
+    public void addFile(File file) throws InvalidSourceException {
+        ProviderServices provServ = RasterLocator.getManager().getProviderServices();
+        DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager();
+
+        setFirstProviderToNotTiled();
+
+        List<RasterDataParameters> storeParametersList = provServ.createParametersList(file);
+
+        for (int j = 0; j < storeParametersList.size(); j++) {
+            RasterProvider newFileProv;
+            try {
+                newFileProv = (RasterProvider)dataManager.createProvider(storeServices, storeParametersList.get(j));
+                if(!newFileProv.isTiled() && checkNewProvider(newFileProv)) {
+                    getParameters().addProvider(newFileProv);
+                }
+            } catch (InitializeException e) {
+                throw new InvalidSourceException("", e);
+            } catch (ProviderNotRegisteredException e) {
+                throw new InvalidSourceException("", e);
+            }
+        }
+    }
+
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileServerExplorerParameters.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileServerExplorerParameters.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileServerExplorerParameters.java	(revision 8080)
@@ -0,0 +1,88 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.raster.multifile.io;
+
+import org.gvsig.fmap.dal.DataServerExplorerParameters;
+import org.gvsig.fmap.dal.spi.AbstractDataParameters;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObjectManager;
+
+/**
+ * Parameters for the Multifile explorer provider
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class MultiFileServerExplorerParameters extends AbstractDataParameters implements DataServerExplorerParameters {
+	public static final String     DYNCLASS_NAME       = "MultifileServerExplorerParameters";
+	protected static DynClass      DYNCLASS            = null;
+	private DelegatedDynObject     delegatedDynObject  = null;
+	
+	
+	public MultiFileServerExplorerParameters() {
+		super();
+		initialize();
+	}
+
+	protected void initialize() {
+		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
+				.getDynObjectManager().createDynObject(
+						DYNCLASS);
+	}
+	
+	public static void registerDynClass() {
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+		DynClass dynClass;
+		
+		if(dynman == null)
+			return;
+		
+		if (DYNCLASS == null) {
+			dynClass = dynman.add(DYNCLASS_NAME);
+
+			DYNCLASS = dynClass;
+		}
+
+	}
+	
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return delegatedDynObject;
+	}
+
+	public String getDataStoreName() {
+		return MultiFileProvider.NAME;
+	}
+	
+	public String getDescription() {
+		return MultiFileProvider.DESCRIPTION;
+	}
+	
+	public String getExplorerName() {
+		return MultiFileProvider.NAME;
+	}
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileServerExplorerParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileDataParameters.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileDataParameters.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileDataParameters.java	(revision 8080)
@@ -0,0 +1,93 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.raster.multifile.io;
+
+import java.net.URI;
+import java.util.List;
+
+import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
+import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters;
+import org.gvsig.fmap.dal.spi.DataStoreProvider;
+import org.gvsig.raster.impl.provider.RasterProvider;
+
+/**
+ * Parameters for the Multifile provider
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public interface MultiFileDataParameters extends RasterDataParameters {
+	public static final String            FIELD_PROVIDERS           = "Providers";
+
+	/**
+	 * Removes all providers
+	 */
+	public void removeAllProviders();
+
+	/**
+	 * Returns true if this multifile has providers loaded
+	 * @return boolean
+	 */
+	public boolean hasProviders();
+
+	/**
+	 * Removes a provider from the list
+	 * @param uri
+	 */
+	public void removeProvider(URI uri);
+
+	/**
+	 * Adds a provider to the list if the this is not tiled
+	 * @param provider
+	 * @param prov
+	 */
+	public void addProviderNotTiled(DataStoreProvider provider);
+
+	/**
+	 * Set the selected provider in the first position
+	 * @param provider
+	 */
+	public void setFirstProvider(DataStoreProvider provider);
+
+	/**
+	 * Adds a provider to the list
+	 * @param provider
+	 * @param prov
+	 */
+	public void addProvider(DataStoreProvider provider);
+
+	/**
+	 * Adds a provider to the list from a RasterDataStore
+	 * @param rasterDataStore
+	 */
+	public void addProvider(RasterDataStore rasterDataStore);
+
+	/**
+	 * Gets the list of providers
+	 * @return the list of providers
+	 */
+	public List<RasterProvider> getProviders();
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileDataParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/pom.xml
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/pom.xml	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.io/pom.xml	(revision 8080)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>org.gvsig.raster.multifile.io</artifactId>
+	<packaging>jar</packaging>
+	<name>org.gvsig.raster.multifile.io</name>
+	<parent>
+		<groupId>org.gvsig</groupId>
+		<artifactId>org.gvsig.raster.multifile</artifactId>
+		<version>2.2.59</version>
+	</parent>
+	<dependencies>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.raster.lib.api</artifactId>
+            <scope>compile</scope>
+		</dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.lib.impl</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.raster.cache.lib.api</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<!--<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.jproj</artifactId>
+			<classifier>${native_classifier}</classifier>
+			<type>tar.gz</type>
+            <scope>runtime</scope>
+		</dependency>-->
+		<dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.lib</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        
+        
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.impl</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.dal.spi</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.projection.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.projection.cresques.impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+         <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.compat.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.compat.se</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.geometry.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+    <!--
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.geometry.generalpath</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.geometry.operation</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+    -->
+	</dependencies>
+</project>

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


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

.settings

.classpath

.project


Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/pom.xml
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/pom.xml	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/pom.xml	(revision 8080)
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>org.gvsig.raster.multifile.app.multifileclient</artifactId>
+	<packaging>jar</packaging>
+	<name>Formats: Multi file format support</name>
+	<description>Multi file data provider for gvSIG</description>
+	
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.raster.multifile</artifactId>
+        <version>2.2.59</version>
+    </parent>
+    
+    <developers>
+        <developer>
+            <id>nbrodin</id>
+            <name>Nacho Brodin</name>
+            <email>nachobrodin@gmail.com</email>
+            <roles>
+                <role>Architect</role>
+                <role>Developer</role>
+            </roles>
+        </developer>
+    </developers>
+    
+	<dependencies>
+
+		<dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.app.common</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.algorithm</artifactId>
+            <scope>compile</scope>
+        </dependency>
+	    <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.lib.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.swing.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+		 <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.ui</artifactId>
+            <scope>compile</scope>
+        </dependency>
+		<dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.multifile.io</artifactId>
+        </dependency>
+        <dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.raster.fmap</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.app.mainplugin</artifactId>
+            <scope>compile</scope>
+		</dependency>
+         <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.control</artifactId>
+            <scope>compile</scope>
+        </dependency>
+         <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.andami</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.i18n</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.lib</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.impl</artifactId>
+            <scope>compile</scope>
+        </dependency>
+         <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.spi</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+             <groupId>org.gvsig</groupId>
+             <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
+             <scope>compile</scope>
+        </dependency>
+        <dependency>
+             <groupId>org.gvsig</groupId>
+             <artifactId>org.gvsig.fmap.mapcontext.impl</artifactId>
+             <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.projection.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.projection.cresques.impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+	</dependencies>
+	
+	<properties>
+		<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/Raster/pool</gvsig.package.info.poolURL>
+        <gvsig.package.info.dependencies>required: org.gvsig.raster.tilecache.app -ge 2, required: org.gvsig.raster.mainplugin -ge 2</gvsig.package.info.dependencies>
+        <gvsig.package.info.categories>Raster</gvsig.package.info.categories>
+    	<gvsig.package.info.state>testing</gvsig.package.info.state>
+    	<gvsig.package.info.official>true</gvsig.package.info.official>
+    </properties>
+</project>

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

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/buildNumber.properties
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/buildNumber.properties	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/buildNumber.properties	(revision 8080)
@@ -0,0 +1,2 @@
+#Tue Sep 26 23:55:45 CEST 2017
+buildNumber=111

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/buildNumber.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/assembly/gvsig-plugin-package.xml
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/assembly/gvsig-plugin-package.xml	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/assembly/gvsig-plugin-package.xml	(revision 8080)
@@ -0,0 +1,37 @@
+<assembly>
+  <id>gvsig-plugin-package</id>
+  <formats>
+    <format>zip</format>
+  </formats>
+  <baseDirectory>${project.artifactId}</baseDirectory>
+  <includeBaseDirectory>true</includeBaseDirectory>
+  <files>
+    <file>
+      <source>target/${project.artifactId}-${project.version}.jar</source>
+      <outputDirectory>lib</outputDirectory>
+    </file>
+    <file>
+      <source>target/package.info</source>
+    </file>
+  </files>
+
+  <fileSets>
+    <fileSet>
+      <directory>src/main/resources-plugin</directory>
+      <outputDirectory>.</outputDirectory>
+    </fileSet>
+  </fileSets>
+
+
+  <dependencySets>
+    <dependencySet>
+      <useProjectArtifact>false</useProjectArtifact>
+	  <useTransitiveDependencies>false</useTransitiveDependencies>
+      <outputDirectory>lib</outputDirectory>
+      <includes> 
+			<include>org.gvsig:org.gvsig.raster.multifile.app.multifileclient:jar</include>
+			<include>org.gvsig:org.gvsig.raster.multifile.io:jar</include>
+	  </includes>
+	</dependencySet>
+  </dependencySets>
+</assembly>

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/assembly/gvsig-plugin-package.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultifileClientExtension.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultifileClientExtension.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultifileClientExtension.java	(revision 8080)
@@ -0,0 +1,128 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.raster.multifile.app;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Locale;
+
+import javax.swing.JComponent;
+
+import org.gvsig.andami.IconThemeHelper;
+import org.gvsig.andami.PluginServices;
+import org.gvsig.andami.plugins.Extension;
+import org.gvsig.i18n.Messages;
+import org.gvsig.raster.multifile.app.panel.BandSelectorPanel;
+import org.gvsig.raster.multifile.app.panel.MainWindow;
+import org.gvsig.raster.swing.RasterSwingLocator;
+import org.gvsig.raster.swing.basepanel.IButtonsPanel;
+import org.gvsig.raster.swing.newlayer.CreateNewLayerPanel;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+
+/**
+ * Extension for adding grid netcdf support to gvSIG.
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class MultifileClientExtension extends Extension implements ActionListener {
+	private CreateNewLayerPanel             newLayerPanel        = null;
+	private MainWindow                      layerNamewindow      = null;
+	private MainWindow                      bandSelectorwindow   = null;
+	private MainDialogActions               actions              = null;
+
+	public void initialize() {
+		ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
+
+		ExtensionPoint point = extensionPoints.get("AplicationPreferences");
+		point = extensionPoints.get("RasterSEPropertiesDialog");
+		point.append("Bandas", "", BandSelectorPanel.class);
+
+		point = extensionPoints.add("GenericToolBarMenu");
+		point.append("Multifile", "", MultiFileCreatorTocMenuEntry.getSingleton());
+		MultiFileCreatorTocMenuEntry.setExtension(this);
+
+		if (!Messages.hasLocales()) {
+			Messages.addLocale(Locale.getDefault());
+		}
+
+		Messages.addResourceFamily("org.gvsig.raster.multifile.app.i18n.text",
+				MultifileClientExtension.class.getClassLoader(),
+				MultifileClientExtension.class.getClass().getName());
+
+		initilizeIcons();
+	}
+
+	public void execute(String actionCommand) {
+		if (actionCommand.compareTo("MultifileCreator") == 0) {
+			layerNamewindow = new MainWindow((JComponent)getNewLayerPanel(),
+					Messages.getText("select_output_file"), 300, 150, this);
+			PluginServices.getMDIManager().addCentredWindow(layerNamewindow);
+    	}
+	}
+
+	private void initilizeIcons() {
+		IconThemeHelper.registerIcon(null, "multifile-icon", this);
+    }
+
+	public boolean isEnabled() {
+		return true;
+	}
+
+	public boolean isVisible() {
+		return true;
+	}
+
+	/**
+	 * @return CreateNewLayerPanel
+	 */
+	public CreateNewLayerPanel getNewLayerPanel() {
+		if(newLayerPanel == null) {
+			newLayerPanel = RasterSwingLocator.getSwingManager().createNewLayerPanel();
+		}
+		return newLayerPanel;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		//Accept the window with the layer name
+		if(e.getSource() == layerNamewindow.getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT)) {
+			String file = getNewLayerPanel().getFileSelected();
+			String folder = getNewLayerPanel().getDirectorySelected();
+			BandSelectorPanel panel = new BandSelectorPanel(BandSelectorPanel.TYPE_DIALOG);
+			panel.getListener().setDestination(file, folder);
+			actions = new MainDialogActions(panel, file, folder);
+			bandSelectorwindow = new MainWindow(panel, Messages.getText("add_files"), 500, 400, this, true);
+			PluginServices.getMDIManager().addCentredWindow(bandSelectorwindow);
+		}
+
+		//Button of load layer in the main dialog
+		if(e.getSource() == bandSelectorwindow.getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR1)) {
+			actions.loadLayer();
+		}
+
+		//Button of create one file with al files
+		if(e.getSource() == bandSelectorwindow.getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR2)) {
+			actions.buildOneLayer();
+		}
+
+	}
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultifileClientExtension.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultiFileCreatorTocMenuEntry.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultiFileCreatorTocMenuEntry.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultiFileCreatorTocMenuEntry.java	(revision 8080)
@@ -0,0 +1,72 @@
+package org.gvsig.raster.multifile.app;
+
+import javax.swing.Icon;
+
+import org.gvsig.andami.IconThemeHelper;
+import org.gvsig.andami.plugins.Extension;
+import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction;
+import org.gvsig.app.project.documents.view.toc.ITocItem;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.i18n.Messages;
+import org.gvsig.raster.mainplugin.toolbar.IGenericToolBarMenuItem;
+
+/**
+ * @author gvSIG team
+ *
+ */
+public class MultiFileCreatorTocMenuEntry extends AbstractTocContextMenuAction implements IGenericToolBarMenuItem {
+	static private MultiFileCreatorTocMenuEntry     singleton  = null;
+	private static Extension                     extension  = null;
+
+
+	/**
+	 * @param ext
+	 */
+	public static void setExtension(Extension ext) {
+		extension = ext;
+	}
+
+	private MultiFileCreatorTocMenuEntry() {}
+
+	/**
+	 * @return MultiFileCreatorTocMenuEntry
+	 */
+	static public MultiFileCreatorTocMenuEntry getSingleton() {
+		if (singleton == null)
+			singleton = new MultiFileCreatorTocMenuEntry();
+		return singleton;
+	}
+
+	public String getGroup() {
+		return "Dataset";
+	}
+
+	public int getGroupOrder() {
+		return 55;
+	}
+
+	public int getOrder() {
+		return 0;
+	}
+
+	public String getText() {
+		return Messages.getText("create_multifile");
+	}
+
+	public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
+		return true;
+	}
+
+	public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
+		return true;
+	}
+
+	public void execute(ITocItem item, FLayer[] selectedItems) {
+		extension.execute("MultifileCreator");
+	}
+
+	public Icon getIcon() {
+		return IconThemeHelper.getImageIcon("multifile-icon");
+	}
+
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultiFileCreatorTocMenuEntry.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorFileList.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorFileList.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorFileList.java	(revision 8080)
@@ -0,0 +1,196 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.raster.multifile.app.panel;
+
+import java.awt.BorderLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.ListSelectionModel;
+
+import org.gvsig.gui.beans.Messages;
+
+
+/**
+ * Panel que contiene la lista de ficheros cargados desde donde se leen las
+ * bandas visualizadas. Contiene controles para a�adir y eliminar los ficheros,
+ * as� como un control para seleccionar el n�mero de bandas a visualizar.
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class BandSelectorFileList extends JPanel {
+	private static final long serialVersionUID = 3329020254004687818L;
+	private JScrollPane       jScrollPane      = null;
+	private JButton           addButton        = null;
+	private JButton           delButton        = null;
+	private JList             jList            = null;
+	private DefaultListModel  listModel        = null;
+	private JPanel            jPanel1          = null;
+
+	/**
+	* This is the default constructor
+	*/
+	public BandSelectorFileList() {
+		super();
+		listModel = new DefaultListModel();
+		initialize();
+	}
+
+	/**
+	 * Inicializaci�n de componentes gr�ficos
+	 *
+	 */
+	private void initialize() {
+		setLayout(new BorderLayout());
+		add(getJScrollPane(), BorderLayout.CENTER);
+		add(getButtonsPanel(), BorderLayout.EAST);
+	}
+
+	/**
+	 * This method initializes jScrollPane
+	 *
+	 * @return javax.swing.JScrollPane
+	 */
+	private JScrollPane getJScrollPane() {
+		if (jScrollPane == null) {
+			jScrollPane = new JScrollPane();
+			jScrollPane.setViewportView(getJList());
+		}
+		return jScrollPane;
+	}
+
+	/**
+	 * Obtiene el bot�n de a�adir fichero
+	 * @return JButton
+	 */
+	public JButton getJButtonAdd() {
+		if (addButton == null) {
+			addButton = new JButton(Messages.getText("anadir"));
+			addButton.setPreferredSize(new java.awt.Dimension(80, 25));
+		}
+		return addButton;
+	}
+
+	/**
+	 * Obtiene el bot�n de eliminar fichero
+	 * @return JButton
+	 */
+	public JButton getJButtonRemove() {
+		if (delButton == null) {
+			delButton = new JButton(Messages.getText("eliminar"));
+			delButton.setPreferredSize(new java.awt.Dimension(80, 25));
+		}
+		return delButton;
+	}
+
+	/**
+	 * This method initializes jList
+	 *
+	 * @return javax.swing.JList
+	 */
+	public JList getJList() {
+		if (jList == null) {
+			jList = new JList(listModel);
+			jList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+			jList.setLayoutOrientation(JList.VERTICAL);
+		}
+		return jList;
+	}
+
+	/**
+	 * This method initializes jPanel1
+	 *
+	 * @return javax.swing.JPanel
+	 */
+	private JPanel getButtonsPanel() {
+		if (jPanel1 == null) {
+			jPanel1 = new JPanel();
+			GridBagConstraints gbc = new GridBagConstraints();
+			gbc.insets = new Insets(0, 0, 3, 0);
+			gbc.weightx = 1.0;
+			jPanel1.setLayout(new GridBagLayout());
+			jPanel1.add(getJButtonAdd(), gbc);
+			gbc.gridy = 1;
+			jPanel1.add(getJButtonRemove(), gbc);
+		}
+		return jPanel1;
+	}
+
+	/**
+	 * A�ade el nombre de un fichero a la lista
+	 * @param fName
+	 */
+	public void addFName(String fName) {
+		listModel.addElement(fName);
+	}
+
+	/**
+	 * Elimina un fichero de la lista
+	 * @param fName
+	 */
+	public void removeFName(String fName) {
+		for (int i = 0; i < listModel.size(); i++) {
+			if(((String)listModel.get(i)).endsWith(fName))
+				listModel.remove(i);
+		}
+	}
+
+	/**
+	 * Elimina todos los ficheros de la lista
+	 */
+	public void clear() {
+		listModel.clear();
+	}
+
+	/**
+	 * Obtiene el n�mero de ficheros en la lista
+	 * @return number of files
+	 */
+	public int getNFiles() {
+		return listModel.size();
+	}
+
+	/**
+	 * Obtiene el modelo de la lista
+	 * @return DefaultListModel
+	 */
+	public DefaultListModel getModel() {
+		return listModel;
+	}
+
+	/**
+	 * Activa y desactiva el control
+	 * @param enabled true para activar y false para desactivar
+	 */
+	public void setEnabled(boolean enabled) {
+		getJButtonAdd().setEnabled(enabled);
+		getJButtonRemove().setEnabled(enabled);
+		getJList().setEnabled(enabled);
+		getJScrollPane().setEnabled(enabled);
+	}
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorFileList.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/DriverFileFilter.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/DriverFileFilter.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/DriverFileFilter.java	(revision 8080)
@@ -0,0 +1,73 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+package org.gvsig.raster.multifile.app.panel;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import javax.swing.filechooser.FileFilter;
+
+import org.gvsig.raster.fmap.layers.DefaultFLyrRaster;
+/**
+ * Clase para indicar los ficheros que se ver�n en el JFileChooser.
+ * 
+ * @version 04/09/2007
+ * @author BorSanZa - Borja S�nchez Zamorano (borja.sanchez@iver.es)
+ */
+public class DriverFileFilter extends FileFilter {
+
+	
+	public boolean accept(File f) {
+		if (f.isDirectory())
+			return true;
+
+		if (f.getParentFile().getName().equals("cellhd")) {
+			if (f.getName().endsWith(".rmf") || f.getName().endsWith(".rmf~"))
+				return false;
+			return true;
+		}
+
+		// Comprobamos que no sea un rmf propio, osea, que contenga xml
+		if (f.getName().toLowerCase().endsWith(".rmf")) {
+			FileInputStream reader = null;
+			try {
+				reader = new FileInputStream(f);
+				String xml = "";
+				for (int i = 0; i < 6; i++)
+					xml += (char) reader.read();
+				if (xml.equals("<?xml "))
+					return false;
+			} catch (Exception e) {
+			} finally {
+				try {
+					reader.close();
+				} catch (Exception e) {}
+			}
+		}
+
+		return DefaultFLyrRaster.isFileSupported(f);
+	}
+
+	public String getDescription() {
+		return "gvSIG Raster Driver";
+	}
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/DriverFileFilter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorNewLayerListener.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorNewLayerListener.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorNewLayerListener.java	(revision 8080)
@@ -0,0 +1,200 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.raster.multifile.app.panel;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JRadioButton;
+
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException;
+import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException;
+import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
+import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.swing.FilesystemExplorerWizardPanel;
+import org.gvsig.gui.beans.swing.JFileChooser;
+import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
+import org.gvsig.i18n.Messages;
+import org.gvsig.raster.multifile.io.MultiFileDataParameters;
+import org.gvsig.raster.multifile.io.MultiFileProvider;
+import org.gvsig.raster.swing.RasterSwingLibrary;
+import org.gvsig.raster.swing.basepanel.ButtonsPanelEvent;
+import org.gvsig.tools.locator.LocatorException;
+
+/**
+ * Class to manage events when this functionality is call to create a new multifile layer
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class BandSelectorNewLayerListener extends AbstractBandSelectorListener {
+	protected RasterDataStore       mainRasterStore  = null;
+
+	/**
+	 * Constructor
+	 * @param bs Panel del selector de bandas
+	 */
+	public BandSelectorNewLayerListener(BandSelectorPanel bs) {
+		super(bs);
+	}
+
+	public RasterDataStore getResult() {
+		return mainRasterStore;
+	}
+
+	/**
+	 * Listener para la gesti�n de los botones de a�adir, eliminar fichero y
+	 * el combo de selecci�n de bandas.
+	 */
+	public void actionPerformed(ActionEvent e) {
+		if (e.getSource().equals(bandSetupPanel.getFileList().getJButtonAdd())) {
+			addFileBand();
+			return;
+		}
+
+		if (e.getSource().equals(bandSetupPanel.getFileList().getJButtonRemove())) {
+			delFileBand();
+			return;
+		}
+		if(e.getSource() instanceof JRadioButton) {
+			return;
+		}
+		apply();
+	}
+
+	public void actionButtonPressed(ButtonsPanelEvent e) {
+
+	}
+
+	@Override
+	public void setNewBandsPositionInRendering() {
+
+	}
+
+	@Override
+	public void apply() {
+	}
+
+	@Override
+	public void addFileBand() {
+		JFileChooser fileChooser = createJFileChooser();
+		int result = fileChooser.showOpenDialog(bandSetupPanel);
+
+		if (result == JFileChooser.APPROVE_OPTION) {
+			File[] files = fileChooser.getSelectedFiles();
+			if(files == null || files.length <= 0)
+				return;
+
+			JFileChooser.setLastPath(FilesystemExplorerWizardPanel.OPEN_LAYER_FILE_CHOOSER_ID, files[0]);
+			int initPosition = 0;
+
+			if(mainRasterStore == null) {
+				initPosition = 1;
+				MultiFileProvider provider = createMultiFileProvider(file, folder);
+				MultiFileDataParameters newParamsMultifile = (MultiFileDataParameters)provider.getDataParameters();
+
+				try {
+					RasterDataStore firstDataStore = RasterLocator.getManager().getProviderServices().open(files[0].getAbsolutePath());
+					newParamsMultifile.addProvider(firstDataStore);
+					mainRasterStore = RasterLocator.getManager().getProviderServices().open(provider, provider.getDataStoreParameters());
+				} catch (RasterDriverException e) {
+					log.debug("Error loading the main store", e);
+				} catch (LocatorException e) {
+					log.debug("Error loading the main store", e);
+				} catch (NotSupportedExtensionException e) {
+					log.debug("Error loading the main store", e);
+				} catch (InitializeException e) {
+					log.debug("Error loading the main store", e);
+				} catch (ProviderNotRegisteredException e) {
+					log.debug("Error loading the main store", e);
+				}
+			}
+
+			List<File> fileList = new ArrayList<File>();
+
+			for (int i = initPosition; i < files.length; i++) {
+				//Checks that the file does not exist
+				URI[] uris = mainRasterStore.getURIByProvider();
+				boolean exists = false;
+				for (int j = 0; j < uris.length; j++) {
+					if (new File(uris[j]).getAbsolutePath().endsWith(files[i].getName())) {
+						RasterSwingLibrary.messageBoxError( Messages.getText("fichero_existe") + ": " + files[i].getAbsolutePath(), bandSetupPanel);
+						exists = true;
+						break;
+					}
+				}
+				if(!exists)
+					fileList.add(files[i]);
+			}
+
+			if(!checkStoresCompatibility(mainRasterStore, fileList))
+				return;
+
+			if(mainRasterStore.isMultiFile()) {
+				for (int i = 0; i < fileList.size(); i++) {
+					try {
+						mainRasterStore.addFile(fileList.get(i)); //.getAbsolutePath());
+					} catch (InvalidSourceException e) {
+						RasterSwingLibrary.messageBoxError(Messages.getText("addband_error"), bandSetupPanel, e);
+					}
+				}
+
+				mainRasterStore.setProvider(mainRasterStore.getProvider());
+
+				//It shows the files and bands in the panel
+				try {
+					bandSetupPanel.addFiles(mainRasterStore);
+				} catch (NotInitializeException e) {
+					RasterSwingLibrary.messageBoxError("table_not_initialize", this, e);
+				}
+			}
+		}
+	}
+
+	@Override
+	public void delFileBand() {
+		if(mainRasterStore == null)
+			return;
+
+		Object[] objects = bandSetupPanel.getFileList().getJList().getSelectedValues();
+
+		for (int i = objects.length - 1; i >= 0; i--) {
+			if (bandSetupPanel.getFileList().getNFiles() > 1) {
+				String pathName = objects[i].toString();
+				mainRasterStore.removeFile(new File(pathName));
+
+				String file = pathName.substring(pathName.lastIndexOf(File.separator) + 1);
+				file = file.substring(file.lastIndexOf("\\") + 1);
+				bandSetupPanel.removeFile(file);
+			}
+		}
+
+		setNewBandsPositionInRendering();
+	}
+
+
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorNewLayerListener.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPanel.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPanel.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPanel.java	(revision 8080)
@@ -0,0 +1,743 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.raster.multifile.app.panel;
+
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ComponentEvent;
+import java.awt.image.DataBuffer;
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.DefaultTableModel;
+
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
+import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation;
+import org.gvsig.fmap.dal.coverage.store.props.Transparency;
+import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
+import org.gvsig.gui.beans.table.TableContainer;
+import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
+import org.gvsig.i18n.Messages;
+import org.gvsig.raster.fmap.layers.FLyrRaster;
+import org.gvsig.raster.fmap.layers.IRasterLayerActions;
+import org.gvsig.raster.mainplugin.properties.RasterPropertiesTocMenuEntry;
+import org.gvsig.raster.swing.RasterSwingLibrary;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Selecciona las bandas visibles en un raster. Contiene una tabla con una fila
+ * por cada banda de la imagen. Por medio de checkbox se selecciona para cada
+ * RGB que banda de la imagen ser� visualizada.
+ *
+
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class BandSelectorPanel extends AbstractPanel implements TableModelListener {
+	final private static long       serialVersionUID  = -3370601314380922368L;
+	public static final int         TYPE_PROPERTIES   = 0;
+	public static final int         TYPE_DIALOG       = 1;
+
+	private final String[]          columnNames       = { "A", "R", "G", "B", "Band" };
+	private final int[]             columnWidths      = { 22, 22, 22, 22, 334 };
+
+	private FLyrRaster              fLayer = null;
+
+	private BandSelectorFileList    fileList          = null;
+
+	// Ultima y penultima columnas activadas del jtable para cuando hay 2 bandas seleccionadas en el combo
+	private int[]                   col               = { 0, 1 };
+	private AbstractBandSelectorListener
+	                                panelListener     = null;
+	private TableContainer          table             = null;
+	private JButton                 saveButton        = null;
+
+	private JPanel                  buttonsPanel      = null;
+	private JComboBox		        jComboBox = null;
+
+	private static final Logger logger =
+        LoggerFactory.getLogger(BandSelectorPanel.class);
+	/**
+	 * Constructor to be instantiated from the properties panels
+	 */
+	public BandSelectorPanel() {
+		super();
+		panelListener = new BandSelectorPropertiesListener(this);
+		initialize();
+	}
+
+	/**
+	 * This method initializes
+	 * @param type
+	 */
+	public BandSelectorPanel(int type) {
+		super();
+		if(type == TYPE_PROPERTIES)
+			panelListener = new BandSelectorPropertiesListener(this);
+		if(type == TYPE_DIALOG)
+			panelListener = new BandSelectorNewLayerListener(this);
+		initialize();
+	}
+
+	/**
+	 * @return AbstractBandSelectorListener
+	 */
+	public AbstractBandSelectorListener getListener() {
+		return panelListener;
+	}
+
+	/**
+	 * This method initializes this
+	 */
+	protected void initialize() {
+		GridBagConstraints gbc = new GridBagConstraints();
+		setLayout(new GridBagLayout());
+		gbc.insets = new Insets(0, 0, 0, 0);
+		gbc.fill = GridBagConstraints.BOTH;
+
+		gbc.weightx = 1.0;
+		gbc.weighty = 1.0;
+		add(getFileList(), gbc);
+
+		gbc.gridy = 1;
+		add(getARGBTable(), gbc);
+
+		gbc.weighty = 0;
+		gbc.gridy = 2;
+		gbc.fill = GridBagConstraints.EAST;
+		gbc.anchor = GridBagConstraints.EAST;
+		gbc.insets = new Insets(0, 0, 0, 8);
+		if(panelListener instanceof BandSelectorPropertiesListener)
+			add(getButtonsPanel(), gbc);
+
+		this.setPreferredSize(new Dimension(100, 80));
+		super.setLabel(Messages.getText("bands_panel"));
+
+		this.setPriority(80);
+	}
+
+	/**
+	 * Obtiene el panel que contiene la lista de ficheros por banda.
+	 * @return Panel FileList
+	 */
+	public BandSelectorFileList getFileList() {
+		if (fileList == null)
+			fileList = new BandSelectorFileList();
+		return fileList;
+	}
+
+	/**
+	 * Obtiene la Tabla
+	 * @return Tabla de bandas de la imagen
+	 */
+	public TableContainer getARGBTable() {
+		if (table == null) {
+			ArrayList<AbstractBandSelectorListener> listeners = new ArrayList<AbstractBandSelectorListener>();
+			listeners.add(panelListener);
+			table = new TableContainer(columnNames, columnWidths, listeners);
+			table.setModel("ARGBBandSelectorModel");
+			table.setControlVisible(false);
+			table.getModel().addTableModelListener(this);
+			table.initialize();
+		}
+		return table;
+	}
+
+	/**
+	 * Obtiene el Panel con bot�n de salvado y selector de bandas.
+	 * @return JPanel
+	 */
+	public JPanel getButtonsPanel() {
+		if (buttonsPanel == null) {
+			buttonsPanel = new JPanel();
+			buttonsPanel.setLayout(new GridBagLayout());
+			JLabel lbandasVisibles = new JLabel();
+			lbandasVisibles.setText(Messages.getText("bands"));
+
+			GridBagConstraints gbc = new GridBagConstraints();
+			gbc.insets = new Insets(0, 8, 0, 0);
+			gbc.fill = GridBagConstraints.BOTH;
+			gbc.weightx = 1.0;
+			buttonsPanel.add(lbandasVisibles, gbc);
+
+			gbc = new GridBagConstraints();
+			gbc.insets = new Insets(0, 8, 0, 0);
+			gbc.fill = GridBagConstraints.BOTH;
+			gbc.gridx = 1;
+			getNumBandSelectorCombo().setMinimumSize(new Dimension(50, getNumBandSelectorCombo().getMinimumSize().height));
+			getNumBandSelectorCombo().setPreferredSize(new Dimension(50, getNumBandSelectorCombo().getMinimumSize().height));
+			buttonsPanel.add(getNumBandSelectorCombo(), gbc);
+
+			gbc = new GridBagConstraints();
+			gbc.insets = new Insets(0, 8, 0, 0);
+			gbc.fill = GridBagConstraints.BOTH;
+			gbc.weightx = 1.0;
+			gbc.gridx = 2;
+			buttonsPanel.add(getSaveButton(), gbc);
+		}
+		return buttonsPanel;
+	}
+
+	/**
+	 * Obtiene el combo del selector del n�mero de bandas
+	 * @return JComboBox
+	 */
+	public JComboBox getNumBandSelectorCombo() {
+		if (jComboBox == null) {
+			String[] list = { "1", "2", "3" };
+			jComboBox = new JComboBox(list);
+			jComboBox.setSelectedIndex(2);
+			jComboBox.setPreferredSize(new java.awt.Dimension(36, 25));
+		}
+
+		return jComboBox;
+	}
+
+	/**
+	 * Bot�n de salvar la interpretaci�n de color seleccionada como predeterminada en
+	 * la capa
+	 * @return JButton
+	 */
+	public JButton getSaveButton() {
+		if(saveButton == null) {
+			saveButton = new JButton(Messages.getText("save"));
+			saveButton.setToolTipText(Messages.getText("save_color_interpretation"));
+			saveButton.addActionListener(panelListener);
+		}
+		return saveButton;
+	}
+
+	/**
+	 * A�ade la lista de georasterfiles a la tabla
+	 * @param dstore
+	 * @throws NotInitializeException
+	 */
+	public void addFiles(RasterDataStore dstore) throws NotInitializeException {
+		getFileList().clear();
+		clear();
+		if(dstore.isMultiFile()) {
+			URI[] uris = dstore.getURIByProvider();
+			for (int i = 0; i < uris.length; i++) {
+				getFileList().addFName(new File(uris[i]).getAbsolutePath());
+			}
+		} else
+			getFileList().addFName(dstore.getName());
+
+		int nbands = dstore.getBandCount();
+		for (int i = 0; i < nbands; i++) {
+                URI uriByBand = dstore.getURIByBand(i);
+                String bandName = "";
+                if("FILE".equalsIgnoreCase(uriByBand.getScheme())){
+                    File file = new File(uriByBand);
+                    bandName = file.getName();
+                } else {
+                    bandName = dstore.getFullName();
+                }
+
+                String bandType = "";
+
+                switch (dstore.getDataType()[0]) {
+                case DataBuffer.TYPE_BYTE:
+                	bandType = "8U";
+                	break;
+                case DataBuffer.TYPE_INT:
+                	bandType = "32";
+                	break;
+                case DataBuffer.TYPE_DOUBLE:
+                	bandType = "64";
+                	break;
+                case DataBuffer.TYPE_FLOAT:
+                	bandType = "32";
+                	break;
+                case DataBuffer.TYPE_SHORT:
+                	bandType = "16";
+                	break;
+                case DataBuffer.TYPE_USHORT:
+                	bandType = "16U";
+                	break;
+                case DataBuffer.TYPE_UNDEFINED:
+                	bandType = "??";
+                	break;
+                }
+
+                addBand((i + 1) + " [" + bandType + "] " + bandName);
+		}
+
+		if(fLayer != null) {
+			readDrawedBands();
+			saveStatus();
+		}
+		//evaluateControlsEnabled();
+	}
+
+	/**
+	 * Elimina un fichero de la lista
+	 * @param file Nombre del fichero a eliminar
+	 */
+	public void removeFile(String file) {
+		getFileList().removeFName(file);
+
+		for (int i = 0; i < ((DefaultTableModel) getARGBTable().getModel()).getRowCount(); i++) {
+			// Si el fichero borrado estaba seleccionado como banda visible. Pasaremos
+			// esta visibilidad a la banda inmediata superior y si esta acci�n produce
+			// una excepci�n (porque no hay) se pasa al inmediato inferior.
+			if (((String) ((DefaultTableModel) getARGBTable().getModel()).getValueAt(i, 4)).endsWith(file)) {
+				try {
+					if (((Boolean) ((DefaultTableModel) getARGBTable().getModel()).getValueAt(i, 0)).booleanValue()) {
+						((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), i - 1, 1);
+					}
+				} catch (ArrayIndexOutOfBoundsException exc) {
+					((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), i + 1, 1);
+				}
+
+				try {
+					if (((Boolean) ((DefaultTableModel) getARGBTable().getModel()).getValueAt(i, 1)).booleanValue()) {
+						((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), i - 1, 2);
+					}
+				} catch (ArrayIndexOutOfBoundsException exc) {
+					((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), i + 1, 2);
+				}
+
+				try {
+					if (((Boolean) ((DefaultTableModel) getARGBTable().getModel()).getValueAt(i, 2)).booleanValue()) {
+						((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), i - 1, 3);
+					}
+				} catch (ArrayIndexOutOfBoundsException exc) {
+					((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), i + 1, 3);
+				}
+
+				((DefaultTableModel) getARGBTable().getModel()).removeRow(i);
+				i--; // Ojo! que hemos eliminado una fila
+			}
+		}
+		panelListener.setNewBandsPositionInRendering();
+	}
+
+	/**
+	 * Cuando cambiamos el combo de seleccion de numero de bandas a visualizar
+	 * debemos resetear la tabla de checkbox para que no haya activados m�s de los
+	 * permitidos
+	 * @param mode
+	 */
+	public void resetMode(int mode) {
+		DefaultTableModel model = getARGBTable().getModel();
+		// Reseteamos los checkbox
+		for (int i = 0; i < (model.getColumnCount() - 1); i++)
+			for (int j = 0; j < model.getRowCount(); j++)
+				model.setValueAt(Boolean.FALSE, j, i);
+
+		// Asignamos los valores
+		if (getNBands() >= 1) {
+			switch (mode) {
+				case 3:
+					int b = 2;
+					if (getNBands() < 3)
+						b = getNBands() - 1;
+					model.setValueAt(Boolean.TRUE, b, 3);
+				case 2:
+					int g = 1;
+					if (getNBands() == 1)
+						g = 0;
+					model.setValueAt(Boolean.TRUE, g, 2);
+				case 1:
+					model.setValueAt(Boolean.TRUE, 0, 1);
+			}
+		}
+
+		col[0] = 0;
+		col[1] = 1;
+	}
+
+	/**
+	 * A�ade una banda a la tabla bandas de la imagen asignandole un nombre y
+	 * valor a los checkbox
+	 * @param bandName Nombre de la banda
+	 * @throws NotInitializeException
+	 */
+	private void addBand(String bandName) throws NotInitializeException {
+		Object[] row = {	new Boolean(false),
+							new Boolean(false),
+							new Boolean(false),
+							new Boolean(false),
+							bandName };
+		getARGBTable().addRow(row);
+	}
+
+	/**
+	 * Elimina todas las entradas de la tabla de bandas.
+	 */
+	private void clear() {
+		int rows = ((DefaultTableModel) getARGBTable().getModel()).getRowCount();
+		if (rows > 0) {
+			for (int i = 0; i < rows; i++)
+				((DefaultTableModel) getARGBTable().getModel()).removeRow(0);
+		}
+	}
+
+	/**
+	 * Obtiene el n�mero de bandas de la lista
+	 *
+	 * @return the number of bands
+	 */
+	public int getNBands() {
+		return ((DefaultTableModel) getARGBTable().getModel()).getRowCount();
+	}
+
+	/**
+	 * Obtiene el nombre de la banda de la posici�n i de la tabla
+	 *
+	 * @param i
+	 * @return the band name
+	 */
+	public String getBandName(int i) {
+		String s = (String) ((DefaultTableModel) getARGBTable().getModel()).getValueAt(i, 3);
+		return s.substring(s.lastIndexOf("[8U]") + 5, s.length());
+	}
+
+	/**
+	 * Mantiene la asignaci�n entre R, G o B y la banda de la imagen que le
+	 * corresponde
+	 *
+	 * @param nBand Banda de la imagen que corresponde
+	 * @param flag R, G o B se selecciona por medio de un flag que los identifica
+	 */
+	public void assignBand(int nBand, int flag) {
+		Boolean t = new Boolean(true);
+		try {
+			if ((flag & RasterDataStore.ALPHA_BAND) == RasterDataStore.ALPHA_BAND)
+				((DefaultTableModel) getARGBTable().getModel()).setValueAt(t, nBand, 0);
+
+			if ((flag & RasterDataStore.RED_BAND) == RasterDataStore.RED_BAND)
+				((DefaultTableModel) getARGBTable().getModel()).setValueAt(t, nBand, 1);
+
+			if ((flag & RasterDataStore.GREEN_BAND) == RasterDataStore.GREEN_BAND)
+				((DefaultTableModel) getARGBTable().getModel()).setValueAt(t, nBand, 2);
+
+			if ((flag & RasterDataStore.BLUE_BAND) == RasterDataStore.BLUE_BAND)
+				((DefaultTableModel) getARGBTable().getModel()).setValueAt(t, nBand, 3);
+		} catch (ArrayIndexOutOfBoundsException e) {
+
+		}
+	}
+
+	/**
+	 * Obtiene la correspondencia entre el R, G o B y la banda asignada
+	 *
+	 * @param flag R, G o B se selecciona por medio de un flag que los identifica
+	 * @return Banda de la imagen asignada al flag pasado por par�metro
+	 */
+	public int getColorInterpretationByColorBandBand(int flag) {
+		DefaultTableModel model = ((DefaultTableModel) getARGBTable().getModel());
+		if ((flag & RasterDataStore.ALPHA_BAND) == RasterDataStore.ALPHA_BAND) {
+			for (int nBand = 0; nBand < getARGBTable().getModel().getRowCount(); nBand++)
+				if (((Boolean) model.getValueAt(nBand, 0)).booleanValue())
+					return nBand;
+		}
+
+		if ((flag & RasterDataStore.RED_BAND) == RasterDataStore.RED_BAND) {
+			for (int nBand = 0; nBand < getARGBTable().getModel().getRowCount(); nBand++)
+				if (((Boolean) model.getValueAt(nBand, 1)).booleanValue())
+					return nBand;
+		}
+
+		if ((flag & RasterDataStore.GREEN_BAND) == RasterDataStore.GREEN_BAND) {
+			for (int nBand = 0; nBand < getARGBTable().getModel().getRowCount(); nBand++)
+				if (((Boolean) model.getValueAt(nBand, 2)).booleanValue())
+					return nBand;
+		}
+
+		if ((flag & RasterDataStore.BLUE_BAND) == RasterDataStore.BLUE_BAND) {
+			for (int nBand = 0; nBand < getARGBTable().getModel().getRowCount(); nBand++)
+				if (((Boolean) model.getValueAt(nBand, 3)).booleanValue())
+					return nBand;
+		}
+
+		return -1;
+	}
+
+	/**
+	 * Obtiene la interpretaci�n de color por n�mero de banda
+	 * @param nBand N�mero de banda
+	 * @return Interpretaci�n de color. Constante definida en DatasetColorInterpretation
+	 */
+	public String getColorInterpretationByBand(int nBand) {
+		DefaultTableModel model = ((DefaultTableModel) getARGBTable().getModel());
+		for (int col = 0; col < 4; col++) {
+			if(((Boolean) model.getValueAt(nBand, col)).booleanValue()) {
+				switch (col) {
+				case 0: return ColorInterpretation.ALPHA_BAND;
+				case 1: return ColorInterpretation.RED_BAND;
+				case 2: return ColorInterpretation.GREEN_BAND;
+				case 3: return ColorInterpretation.BLUE_BAND;
+				}
+			}
+		}
+		return ColorInterpretation.UNDEF_BAND;
+	}
+
+	/**
+	 * @return the color interpretation
+	 */
+	public ColorInterpretation getSelectedColorInterpretation() {
+		try {
+			String[] colorInter = new String[getARGBTable().getRowCount()];
+			for (int iBand = 0; iBand < getARGBTable().getRowCount(); iBand++) {
+				if(isSelected(iBand, 1) && isSelected(iBand, 2) && isSelected(iBand, 3)) {
+					colorInter[iBand] = ColorInterpretation.GRAY_BAND;
+				} else if(isSelected(iBand, 1) && isSelected(iBand, 2)) {
+					colorInter[iBand] = ColorInterpretation.RED_GREEN_BAND;
+				} else if(isSelected(iBand, 1) && isSelected(iBand, 3)) {
+					colorInter[iBand] = ColorInterpretation.RED_BLUE_BAND;
+				} else if(isSelected(iBand, 2) && isSelected(iBand, 3)) {
+					colorInter[iBand] = ColorInterpretation.GREEN_BLUE_BAND;
+				} else if(isSelected(iBand, 1)) {
+					colorInter[iBand] = ColorInterpretation.RED_BAND;
+				} else if(isSelected(iBand, 2)) {
+					colorInter[iBand] = ColorInterpretation.GREEN_BAND;
+				} else if(isSelected(iBand, 3)) {
+					colorInter[iBand] = ColorInterpretation.BLUE_BAND;
+				} else if(isSelected(iBand, 0)) {
+					colorInter[iBand] = ColorInterpretation.ALPHA_BAND;
+				} else
+					colorInter[iBand] = ColorInterpretation.UNDEF_BAND;
+			}
+			return RasterLocator.getManager().getDataStructFactory().createColorInterpretation(colorInter);
+		} catch (NotInitializeException e) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("table_not_initialize"), this, e);
+		}
+		return null;
+	}
+
+	private boolean isSelected(int iBand, int col) {
+		DefaultTableModel model = ((DefaultTableModel) getARGBTable().getModel());
+		return ((Boolean) model.getValueAt(iBand, col)).booleanValue();
+	}
+
+	public void tableChanged(TableModelEvent e) {
+		getARGBTable().revalidate();
+		revalidate();
+	}
+
+	/**
+	 * @return RasterDataStore
+	 */
+	public RasterDataStore getResult() {
+		return panelListener.getResult();
+	}
+
+	/**
+	 * Activa o desactiva la funcionalidad
+	 */
+	private void actionEnabled() {
+		boolean enabled = true;
+
+		IRasterLayerActions actions = null;
+
+		if(fLayer != null && fLayer instanceof IRasterLayerActions)
+			actions = (IRasterLayerActions)fLayer;
+
+		if (!actions.isActionEnabled(IRasterLayerActions.BANDS_FILE_LIST))
+			enabled = false;
+		getFileList().setEnabled(enabled);
+
+		enabled = true;
+		if (!actions.isActionEnabled(IRasterLayerActions.BANDS_RGB))
+			enabled = false;
+		getARGBTable().setEnabled(enabled);
+
+		// TODO: Mirar el setVisible...
+		if (!actions.isActionEnabled(IRasterLayerActions.BANDS_FILE_LIST) &&
+				!actions.isActionEnabled(IRasterLayerActions.BANDS_RGB))
+			setVisible(false);
+		else
+			setVisible(true);
+
+		if (!actions.isActionEnabled(IRasterLayerActions.SAVE_COLORINTERP))
+			getSaveButton().setVisible(false);
+	}
+
+	/**
+	 * Lee desde el renderizador las bandas que se han dibujado y en que posici�n se ha hecho.
+	 */
+	public void readDrawedBands() {
+		if (fLayer.getRender() != null) {
+			int[] renderBands = fLayer.getRender().getRenderColorInterpretation().buildRenderBands();
+			Transparency transp = fLayer.getRender().getRenderingTransparency();
+			if(transp != null && transp.getAlphaBandNumber() != -1)
+				this.assignBand(transp.getAlphaBandNumber(), RasterDataStore.ALPHA_BAND);
+			for (int i = 0; i < renderBands.length; i++) {
+				if (renderBands[i] >= 0) {
+					switch (i) {
+					case 0:
+						this.assignBand(renderBands[i], RasterDataStore.RED_BAND);
+						break;
+					case 1:
+						this.assignBand(renderBands[i], RasterDataStore.GREEN_BAND);
+						break;
+					case 2:
+						this.assignBand(renderBands[i], RasterDataStore.BLUE_BAND);
+						break;
+					}
+				}
+			}
+		}
+	}
+
+	public void accept() {
+		if (!getPanelGroup().isPanelInGUI(this))
+			return;
+
+		onlyApply();
+	}
+
+	/**
+	 * Aplica y guarda los cambios del panel
+	 */
+	public void apply() {
+		if (!getPanelGroup().isPanelInGUI(this))
+			return;
+
+		onlyApply();
+		saveStatus();
+	}
+
+	/**
+	 * Aplicar los cambios sin guardar su estado
+	 */
+	public void onlyApply() {
+		if (RasterPropertiesTocMenuEntry.enableEvents)
+			panelListener.apply();
+	}
+
+	/**
+	 * Guarda el estado actual del panel
+	 */
+	@SuppressWarnings("unchecked")
+	private void saveStatus() {
+		List<String> aux = new ArrayList<String>();
+		String[] valuesCI = fLayer.getRender().getRenderColorInterpretation().getValues();
+		for (int i = 0; i < valuesCI.length; i++) {
+			aux.add(valuesCI[i]);
+		}
+		getPanelGroup().getProperties().put("renderBands", aux);
+	}
+
+
+	/**
+	 * Deja la capa en el �ltimo estado guardado y la refresca
+	 */
+	@SuppressWarnings("unchecked")
+	public void restoreStatus() {
+		if (fLayer != null)
+			return;
+
+		List<String> aux = (List<String>) getPanelGroup().getProperties().get("renderBands");
+
+		if(fLayer.getRender() != null) {
+			ColorInterpretation ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation((String[])aux.toArray());
+			fLayer.getRender().setRenderColorInterpretation(ci);
+		}
+
+		fLayer.getMapContext().invalidate();
+	}
+
+	public void cancel() {
+		if (!getPanelGroup().isPanelInGUI(this))
+			return;
+
+		restoreStatus();
+	}
+
+	/**
+	 * Activa y desactiva el control
+	 * @param enabled true para activar y false para desactivar
+	 */
+	public void setEnabled(boolean enabled) {
+		if (panelListener != null)
+			panelListener.setEnabledPanelAction(enabled);
+		getARGBTable().setEnabled(enabled);
+		getFileList().setEnabled(enabled);
+	}
+
+	/**
+	 * Sets the current layer when the panel is opened from
+	 * raster properties
+	 */
+	public void setReference(Object ref) {
+		super.setReference(ref);
+
+		if (!(ref instanceof FLyrRaster))
+			return;
+
+		fLayer = (FLyrRaster) ref;
+
+		actionEnabled();
+
+		clear();
+		getFileList().clear();
+
+		//Si tiene tabla de color inicializamos solamente
+
+		if (fLayer.existColorTable()) {
+			((BandSelectorPropertiesListener)panelListener).init(fLayer);
+			return;
+		}
+
+		//Si no tiene tabla de color se a�aden los ficheros e inicializamos
+		try {
+			addFiles(fLayer.getDataStore());
+		} catch (NotInitializeException e) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("table_not_initialize"), this);
+		}
+
+		((BandSelectorPropertiesListener)panelListener).init(fLayer);
+	}
+
+	/**
+	 * @param e
+	 */
+	public void componentHidden(ComponentEvent e) {}
+	/**
+	 * @param e
+	 */
+	public void componentShown(ComponentEvent e) {}
+	/**
+	 * @param e
+	 */
+	public void componentMoved(ComponentEvent e) {}
+
+
+	public void selected() {
+		setReference(fLayer);
+	}
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPanel.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPropertiesListener.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPropertiesListener.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPropertiesListener.java	(revision 8080)
@@ -0,0 +1,321 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.raster.multifile.app.panel;
+
+import java.awt.event.ActionEvent;
+import java.awt.geom.Point2D;
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.FilenameUtils;
+
+import org.gvsig.andami.PluginServices;
+import org.gvsig.andami.ui.mdiManager.WindowInfo;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException;
+import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException;
+import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
+import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters;
+import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation;
+import org.gvsig.fmap.dal.coverage.store.props.Transparency;
+import org.gvsig.fmap.dal.coverage.util.ProviderServices;
+import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.swing.FilesystemExplorerWizardPanel;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.fmap.dal.spi.DataStoreProvider;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.gui.beans.swing.JFileChooser;
+import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
+import org.gvsig.i18n.Messages;
+import org.gvsig.raster.fmap.layers.DefaultFLyrRaster;
+import org.gvsig.raster.fmap.layers.FLyrRaster;
+import org.gvsig.raster.mainplugin.RasterMainPluginUtils;
+import org.gvsig.raster.mainplugin.config.Configuration;
+import org.gvsig.raster.multifile.io.MultiFileDataParameters;
+import org.gvsig.raster.multifile.io.MultiFileProvider;
+import org.gvsig.raster.swing.RasterSwingLibrary;
+import org.gvsig.raster.swing.basepanel.ButtonsPanelEvent;
+
+/**
+ * Clase que maneja los eventos del panel BandSetupPanel. Gestiona el a�adir o
+ * eliminar ficheros de la lista y contiene las acciones a realizar cuando en
+ * panel registrable se pulsa aceptar, aplicar o cancelar.
+ *
+ * @author Nacho Brodin (brodin_ign@gva.es)
+ */
+public class BandSelectorPropertiesListener extends AbstractBandSelectorListener {
+	private JFileChooser          fileChooser    = null;
+	private FLyrRaster            fLayer         = null;
+	private List<File>            fileList       = null;
+
+	/**
+	 * Constructor
+	 * @param bs Panel del selector de bandas
+	 */
+	public BandSelectorPropertiesListener(BandSelectorPanel bs) {
+		super(bs);
+	}
+
+	/**
+	 * Constructor
+	 * @param lyr Capa raster
+	 */
+	public void init(FLyrRaster lyr) {
+		fLayer = lyr;
+	}
+
+	public RasterDataStore getResult() {
+		return fLayer.getDataStore();
+	}
+
+	/**
+	 * Listener para la gesti�n de los botones de a�adir, eliminar fichero y
+	 * el combo de selecci�n de bandas.
+	 */
+	public void actionPerformed(ActionEvent e) {
+		super.actionPerformed(e);
+
+		if (e.getSource().equals(bandSetupPanel.getNumBandSelectorCombo())) {
+			String vBands = (String) bandSetupPanel.getNumBandSelectorCombo().getSelectedItem();
+			if (vBands != null) {
+				if (vBands.compareTo("3") == 0)
+					bandSetupPanel.resetMode(3);
+
+				if (vBands.compareTo("2") == 0)
+					bandSetupPanel.resetMode(2);
+
+				if (vBands.compareTo("1") == 0)
+					bandSetupPanel.resetMode(1);
+			}
+		}
+
+		if (e.getSource().equals(bandSetupPanel.getSaveButton())) {
+			int numBandToRed = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND);
+			int numBandToGreen = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.GREEN_BAND);
+			int numBandToBlue = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.BLUE_BAND);
+			int numBandToAlpha = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND);
+
+			if (!isCorrectAssignedBand(numBandToRed, numBandToGreen, numBandToBlue, numBandToAlpha)) {
+				RasterSwingLibrary.messageBoxError(Messages.getText("combinacion_no_asignable"), bandSetupPanel);
+				return;
+			}
+
+			RasterSwingLibrary.messageBoxYesOrNot(Messages.getText("color_interpretation_continue"), this);
+			RasterDataStore dataSource = fLayer.getDataStore();
+			if(dataSource == null) {
+				RasterSwingLibrary.messageBoxError(Messages.getText("error_carga_capa"), bandSetupPanel);
+				return;
+			}
+
+			//ColorInterpretation ci = dataSource.getColorInterpretation();
+			try {
+				String[] bands = new String[bandSetupPanel.getARGBTable().getRowCount()];
+				ColorInterpretation ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation(bands);
+
+				// Combinaci�n GRAY
+				if ((numBandToRed == numBandToGreen) && (numBandToRed == numBandToBlue) && (numBandToRed >= 0)) {
+					for (int iBand = 0; iBand < bandSetupPanel.getARGBTable().getRowCount(); iBand++) {
+						ci.setColorInterpValue(iBand, ColorInterpretation.UNDEF_BAND);
+					}
+					ci.setColorInterpValue(0, ColorInterpretation.GRAY_BAND);
+					ci.setColorInterpValue(numBandToAlpha, ColorInterpretation.ALPHA_BAND);
+				} else {
+					// Combinaci�n RGB
+					for (int iBand = 0; iBand < bandSetupPanel.getARGBTable().getRowCount(); iBand++)
+						ci.setColorInterpValue(iBand, bandSetupPanel.getColorInterpretationByBand(iBand));
+				}
+				String fileName = fLayer.getDataStore().getName();
+				dataSource.setColorInterpretation(ci);
+				RasterLocator.getManager().getProviderServices().saveObjectToRmfFile(fileName, ci);
+			} catch (RmfSerializerException exc) {
+				RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_rmf"), bandSetupPanel, exc);
+			} catch (NotInitializeException exc) {
+				RasterSwingLibrary.messageBoxError(Messages.getText("table_not_initialize"), bandSetupPanel, exc);
+			}
+		}
+
+		boolean autoRefreshView = Configuration.getValue("general_auto_preview", Boolean.TRUE).booleanValue();
+
+		if (!autoRefreshView)
+			return;
+
+		bandSetupPanel.onlyApply();
+	}
+
+	/**
+	 * A�ade una banda al raster
+	 */
+	public void addFileBand() {
+		fileChooser = createJFileChooser();
+		int result = fileChooser.showOpenDialog(bandSetupPanel);
+
+		if (result == JFileChooser.APPROVE_OPTION) {
+			RasterDataStore dataStore = fLayer.getDataStore();
+			File[] files = fileChooser.getSelectedFiles();
+
+			JFileChooser.setLastPath(FilesystemExplorerWizardPanel.OPEN_LAYER_FILE_CHOOSER_ID, files[0]);
+
+			fileList = new ArrayList<File>();
+
+			for (int i = 0; i < files.length; i++) {
+				//Checks that the file does not exist
+				URI[] uris = dataStore.getURIByProvider();
+				boolean exists = false;
+				for (int j = 0; j < uris.length; j++) {
+					if (new File(uris[j]).getAbsolutePath().endsWith(files[i].getName())) {
+						RasterSwingLibrary.messageBoxError( Messages.getText("fichero_existe") + ": " + files[i].getAbsolutePath(), bandSetupPanel);
+						exists = true;
+						break;
+					}
+				}
+				if(!exists)
+					fileList.add(files[i]);
+			}
+
+			if(!checkStoresCompatibility(fLayer.getDataStore(), fileList))
+				return;
+
+			if(dataStore.isMultiFile()) {
+				for (int i = 0; i < fileList.size(); i++) {
+					try {
+						dataStore.addFile(fileList.get(i));
+					} catch (InvalidSourceException e) {
+						RasterSwingLibrary.messageBoxError(Messages.getText("addband_error"), bandSetupPanel, e);
+					}
+				}
+
+				dataStore.setProvider(dataStore.getProvider());
+
+				//It shows the files and bands in the panel
+				try {
+					bandSetupPanel.addFiles(dataStore);
+				} catch (NotInitializeException e) {
+					RasterSwingLibrary.messageBoxError("table_not_initialize", this, e);
+				}
+			} else {
+				//New layer name
+				WindowInfo wi = PluginServices.getMDIManager().getActiveWindow().getWindowInfo();
+				LayerNameDialog dialog = new LayerNameDialog(new Point2D.Double(wi.getX(), wi.getY()), 300, 80, this);
+				RasterMainPluginUtils.addWindow(dialog);
+			}
+		}
+	}
+
+	/**
+	 * Elimina una banda del raster. Si queda solo un fichero o no se ha
+	 * seleccionado ninguna banda no hace nada.
+	 *
+	 */
+	public void delFileBand() {
+		Object[] objects = bandSetupPanel.getFileList().getJList().getSelectedValues();
+		RasterDataStore dataStore = fLayer.getDataStore();
+
+		for (int i = objects.length - 1; i >= 0; i--) {
+			if (bandSetupPanel.getFileList().getNFiles() > 1) {
+				String pathName = objects[i].toString();
+				dataStore.removeFile(new File(pathName));
+
+				String file = pathName.substring(pathName.lastIndexOf(File.separator) + 1);
+				file = file.substring(file.lastIndexOf("\\") + 1);
+				bandSetupPanel.removeFile(file);
+			}
+		}
+
+		setNewBandsPositionInRendering();
+	}
+
+	/**
+	 * Catchs the events from LayerNameDialog to get the name of the new layer
+	 */
+	public void actionButtonPressed(ButtonsPanelEvent e) {
+		String layerName = (String)e.getSource();
+
+		RasterDataStore dataStore = fLayer.getDataStore();
+		RasterDataParameters paramFirstFile = (RasterDataParameters)dataStore.getParameters();//(RasterDataParameters)((RasterProvider)dataStore.getProvider()).getDataParameters();
+
+		File firstFile = new File(paramFirstFile.getURI());
+        String path = FilenameUtils.getFullPath(firstFile.getAbsolutePath());
+
+		ProviderServices provServ = RasterLocator.getManager().getProviderServices();
+		DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager();
+
+		try {
+			MultiFileProvider provMultifile = createMultiFileProvider(layerName, path);
+			MultiFileDataParameters newParamsMultifile = (MultiFileDataParameters)provMultifile.getDataParameters();
+			newParamsMultifile.addProvider(dataStore);
+
+			//And now it creates and adds the new ones
+			for (int i = 0; i < fileList.size(); i++) {
+				ArrayList<RasterDataParameters> storeParametersList = provServ.createParametersList(fileList.get(i)); //.getAbsolutePath());
+				for (int j = 0; j < storeParametersList.size(); j++) {
+					DataStoreProvider newFileProv = dataManager.createProvider((DataStoreProviderServices)dataStore, storeParametersList.get(j));
+					newParamsMultifile.addProviderNotTiled(newFileProv);
+				}
+			}
+
+			((DefaultFLyrRaster)fLayer).setName(layerName);
+			//Assigns the MultifileProvider to the store
+			dataStore.setProvider((CoverageStoreProvider)provMultifile);
+
+			//It shows the files and bands in the panel
+			try {
+				bandSetupPanel.addFiles(dataStore);
+			} catch (NotInitializeException ex) {
+				RasterSwingLibrary.messageBoxError(Messages.getText("table_not_initialize"), this, ex);
+			}
+
+			ArrayList<File> uriList = new ArrayList<File>();
+			uriList.add(firstFile);
+			for (int i = 0; i < fileList.size(); i++) {
+				uriList.add(fileList.get(i));
+			}
+			saveMultiFileLayer(layerName, path, uriList);
+
+		} catch (Exception exc) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("addband_error"), bandSetupPanel, exc);
+		}
+	}
+
+	/**
+	 * Acciones a ejecutar cuando se aplica
+	 */
+	public void apply() {
+		if (enabled)
+			setNewBandsPositionInRendering();
+	}
+
+	public void setNewBandsPositionInRendering() {
+		if (fLayer != null && fLayer.getRender() != null) {
+			fLayer.getRender().setRenderColorInterpretation(bandSetupPanel.getSelectedColorInterpretation());
+
+			int alphaBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND);
+			Transparency gt = fLayer.getRender().getRenderingTransparency();
+			if(gt != null)
+				gt.setTransparencyBand(alphaBand);
+			fLayer.getMapContext().invalidate();
+		}
+	}
+
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPropertiesListener.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/MainWindow.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/MainWindow.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/MainWindow.java	(revision 8080)
@@ -0,0 +1,147 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2011-2012 Prodevelop S.L
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.multifile.app.panel;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JComponent;
+
+import org.gvsig.andami.PluginServices;
+import org.gvsig.andami.ui.mdiManager.IWindow;
+import org.gvsig.andami.ui.mdiManager.WindowInfo;
+import org.gvsig.i18n.Messages;
+import org.gvsig.raster.swing.basepanel.AbstractButtonsPanel;
+import org.gvsig.raster.swing.basepanel.IButtonsPanel;
+
+
+/**
+ * Basic frame for a gvSIG <code>IWindow</code> object. This frame adds buttons
+ * of Cancel, Accept and others.
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class MainWindow extends AbstractButtonsPanel implements IWindow, ActionListener {
+
+    private static final long  serialVersionUID = -4401123724140025094L;
+    private ActionListener     listener         = null;
+    private WindowInfo         info             = null;
+
+    private Object profile = WindowInfo.EDITOR_PROFILE;
+
+    /**
+     * @param panel
+     * @param title
+     * @param w
+     * @param h
+     * @param actionListener
+     */
+    public MainWindow(JComponent panel, String title, int w, int h, ActionListener actionListener) {
+    	this.listener = actionListener;
+
+    	setLayout(new BorderLayout());
+		add(panel, BorderLayout.CENTER);
+
+		getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY).setVisible(false);
+        getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT).addActionListener(this);
+        getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL).addActionListener(this);
+
+        info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE);
+        info.setTitle(title);
+        info.setWidth(w);
+        info.setHeight(h);
+    }
+
+    /**
+     * @param panel
+     * @param title
+     * @param w
+     * @param h
+     * @param actionListener
+     * @param mainPanel
+     */
+    public MainWindow(JComponent panel, String title, int w, int h, ActionListener actionListener, boolean mainPanel) {
+    	this.listener = actionListener;
+
+    	setLayout(new BorderLayout());
+		add(panel, BorderLayout.CENTER);
+
+		getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY).setVisible(false);
+
+		if(mainPanel) {
+			getButtonsPanel().addButton(Messages.getText("load_layer"), IButtonsPanel.BUTTON_USR1);
+			getButtonsPanel().addButton(Messages.getText("generate_file"), IButtonsPanel.BUTTON_USR2);
+			getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY).setVisible(false);
+			getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT).setVisible(false);
+			getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL).setVisible(false);
+			getButtonsPanel().addClose();
+			getButtonsPanel().getButton(IButtonsPanel.BUTTON_CLOSE).addActionListener(this);
+	        getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR1).addActionListener(this);
+	        getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR2).addActionListener(this);
+		} else {
+			getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT).addActionListener(this);
+			getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL).addActionListener(this);
+		}
+
+        info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
+        info.setTitle(title);
+        info.setWidth(w);
+        info.setHeight(h);
+    }
+
+    public WindowInfo getWindowInfo() {
+        return info;
+    }
+
+    public Object getWindowProfile() {
+        return profile;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR1)) {
+    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_USR1, e.getActionCommand()));
+    		PluginServices.getMDIManager().closeWindow(this);
+    	}
+
+    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR2)) {
+    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_USR2, e.getActionCommand()));
+    		PluginServices.getMDIManager().closeWindow(this);
+    	}
+
+    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT)) {
+    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_ACCEPT, e.getActionCommand()));
+    		PluginServices.getMDIManager().closeWindow(this);
+    	}
+
+    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY)) {
+    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_APPLY, e.getActionCommand()));
+    	}
+
+    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL)) {
+    		PluginServices.getMDIManager().closeWindow(this);
+    	}
+
+    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_CLOSE)) {
+    		PluginServices.getMDIManager().closeWindow(this);
+    	}
+    }
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/MainWindow.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/LayerNameDialog.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/LayerNameDialog.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/LayerNameDialog.java	(revision 8080)
@@ -0,0 +1,169 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ */
+package org.gvsig.raster.multifile.app.panel;
+
+import java.awt.BorderLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.geom.Point2D;
+
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import org.gvsig.andami.PluginServices;
+import org.gvsig.andami.ui.mdiManager.IWindow;
+import org.gvsig.andami.ui.mdiManager.WindowInfo;
+import org.gvsig.i18n.Messages;
+import org.gvsig.raster.swing.basepanel.AbstractButtonsPanel;
+import org.gvsig.raster.swing.basepanel.ButtonsPanelEvent;
+import org.gvsig.raster.swing.basepanel.ButtonsPanelListener;
+import org.gvsig.raster.swing.basepanel.IButtonsPanel;
+
+/**
+ * <code>LayerNameDialog</code>.
+ * Window to introduce the name of the new layer
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class LayerNameDialog extends AbstractButtonsPanel implements IWindow, ButtonsPanelListener {
+	private static final long     serialVersionUID = 7362459094802955247L;
+	private JPanel                panel            = null;
+	private String                layerName        = null;
+	private JTextField            name             = null;
+	private ButtonsPanelListener  listener         = null;
+	private Point2D               position         = null;
+
+	/**
+	 * Builds a new window.
+	 * @param position
+	 * @param width
+	 * @param height
+	 * @param listener
+	 */
+	public LayerNameDialog(Point2D position, int width, int height, ButtonsPanelListener listener) {
+		super(IButtonsPanel.BUTTONS_ACCEPTCANCEL);
+		this.position = position;
+		layerName = null;
+		this.listener = listener;
+		this.setSize(width, height);
+		this.setLayout(new BorderLayout(5, 5));
+		this.add(getMainPanel(), java.awt.BorderLayout.CENTER);
+		this.addButtonPressedListener(this);
+	}
+
+	/**
+	 * Builds a new window.
+	 * @param width
+	 * @param height
+	 * @param listener
+	 */
+	public LayerNameDialog(int width, int height, ButtonsPanelListener listener) {
+		this(new Point2D.Double(), width, height, listener);
+	}
+
+	/**
+	 * Gets the main panel
+	 * @return JPanel
+	 */
+	public JPanel getMainPanel() {
+		if (panel == null) {
+			panel = new JPanel();
+			panel.setLayout(new GridBagLayout());
+			GridBagConstraints gbc = new GridBagConstraints();
+			gbc.insets = new Insets(0, 0, 0, 0);
+			gbc.fill = GridBagConstraints.HORIZONTAL;
+			gbc.anchor = GridBagConstraints.CENTER;
+			gbc.weightx = 1.0;
+			panel.add(getNameField(), gbc);
+		}
+		return panel;
+	}
+
+	private JTextField getNameField() {
+		if(name == null) {
+			name = new JTextField();
+		}
+		return name;
+	}
+
+	public WindowInfo getWindowInfo() {
+		WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
+		m_viewinfo.setTitle(Messages.getText("layer_name"));
+		m_viewinfo.setHeight(this.getHeight());
+		m_viewinfo.setWidth(this.getWidth());
+		m_viewinfo.setX((int)position.getX());
+		m_viewinfo.setY((int)position.getY());
+		return m_viewinfo;
+	}
+
+	/**
+	 * Cancel actions
+	 */
+	private void close() {
+		try {
+			PluginServices.getMDIManager().closeWindow(this);
+		} catch (ArrayIndexOutOfBoundsException e) {
+			//Si la ventana no se puede eliminar no hacemos nada
+		}
+	}
+
+	/**
+	 * Accept actions
+	 */
+	private void accept() {
+		String txt = getNameField().getText();
+		if(txt == null || txt.compareTo("") == 0) {
+			JOptionPane.showMessageDialog(null, Messages.getText("character_not_valid"), "", JOptionPane.ERROR_MESSAGE);
+			return;
+		}
+
+		byte[] byteList = txt.getBytes();
+		for (int i = 0; i < byteList.length; i++) {
+			if(byteList[i] < 45 ||
+			   (byteList[i] > 45 && byteList[i] < 48) ||
+			   (byteList[i] > 57 && byteList[i] < 65) ||
+			   (byteList[i] > 90 && byteList[i] < 95) ||
+			   (byteList[i] > 95 && byteList[i] < 97) ||
+			   (byteList[i] > 122 && byteList[i] < 126) ||
+			   (byteList[i] > 126)) {
+				JOptionPane.showMessageDialog(null, Messages.getText("character_not_valid"), "", JOptionPane.ERROR_MESSAGE);
+				return;
+			}
+		}
+
+		layerName = txt;
+		close();
+		listener.actionButtonPressed(new ButtonsPanelEvent(layerName, IButtonsPanel.BUTTON_ACCEPT));
+	}
+
+	public void actionButtonPressed(ButtonsPanelEvent e) {
+		if (e.getButton() == IButtonsPanel.BUTTON_CANCEL) {
+			close();
+		}
+
+		if (e.getButton() == IButtonsPanel.BUTTON_ACCEPT) {
+			accept();
+		}
+	}
+
+	public Object getWindowProfile() {
+		return WindowInfo.PROPERTIES_PROFILE;
+	}
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/LayerNameDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:executable
   + *

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/AbstractBandSelectorListener.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/AbstractBandSelectorListener.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/AbstractBandSelectorListener.java	(revision 8080)
@@ -0,0 +1,284 @@
+package org.gvsig.raster.multifile.app.panel;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.geom.Rectangle2D;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
+import org.gvsig.gui.beans.swing.JFileChooser;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataServerExplorerParameters;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.datastruct.Extent;
+import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException;
+import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
+import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
+import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters;
+import org.gvsig.fmap.dal.coverage.util.ProviderServices;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.swing.FilesystemExplorerWizardPanel;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.i18n.Messages;
+import org.gvsig.raster.multifile.io.MultiFileDataParameters;
+import org.gvsig.raster.multifile.io.MultiFileFormat;
+import org.gvsig.raster.multifile.io.MultiFileProvider;
+import org.gvsig.raster.swing.RasterSwingLibrary;
+import org.gvsig.raster.swing.basepanel.ButtonsPanelListener;
+import org.gvsig.tools.locator.LocatorException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Listener for <code>BandSelectorPanel</code>. This interface is implemented by two listeners
+ * , the new layer listener and the properties panel listener.
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public abstract class AbstractBandSelectorListener implements ActionListener, ButtonsPanelListener {
+	protected Logger                log              = LoggerFactory.getLogger(AbstractBandSelectorListener.class);
+	protected BandSelectorPanel     bandSetupPanel   = null;
+	protected boolean               enabled          = true;
+	protected String                file             = null;
+	protected String                folder           = null;
+
+	/**
+	 * Constructor
+	 * @param bs Panel del selector de bandas
+	 * @param lyr Capa raster
+	 */
+	public AbstractBandSelectorListener(BandSelectorPanel bs) {
+		this.bandSetupPanel = bs;
+		bs.getFileList().getJButtonAdd().addActionListener(this);
+		bs.getFileList().getJButtonRemove().addActionListener(this);
+		bs.getNumBandSelectorCombo().addActionListener(this);
+	}
+
+	/**
+	 * @param file
+	 * @param folder
+	 */
+	public void setDestination(String file, String folder) {
+		this.file = file;
+		this.folder = folder;
+	}
+
+	/**
+	 * Enables or disables the panel action
+	 * @param enabled
+	 */
+	public void setEnabledPanelAction(boolean enabled) {
+		this.enabled = enabled;
+	}
+
+	/**
+	 * Sets the band position when these are rendered. The position is read from
+	 * the band table
+	 */
+	public abstract void setNewBandsPositionInRendering();
+
+	/**
+	 * @return RasterDataStore
+	 */
+	public abstract RasterDataStore getResult();
+
+	/**
+	 * Actions when is applied
+	 */
+	public abstract void apply();
+
+	/**
+	 *
+	 */
+	public abstract void addFileBand();
+
+	/**
+	 *
+	 */
+	public abstract void delFileBand();
+
+	/**
+	 * Listener para la gesti�n de los botones de a�adir, eliminar fichero y
+	 * el combo de selecci�n de bandas.
+	 */
+	public void actionPerformed(ActionEvent e) {
+
+		if (e.getSource().equals(bandSetupPanel.getFileList().getJButtonAdd()))
+			addFileBand();
+
+		if (e.getSource().equals(bandSetupPanel.getFileList().getJButtonRemove()))
+			delFileBand();
+	}
+
+	protected JFileChooser createJFileChooser() {
+		JFileChooser fileChooser = new JFileChooser(
+				FilesystemExplorerWizardPanel.OPEN_LAYER_FILE_CHOOSER_ID,
+				JFileChooser.getLastPath(FilesystemExplorerWizardPanel.OPEN_LAYER_FILE_CHOOSER_ID, null));
+		fileChooser.setMultiSelectionEnabled(true);
+		fileChooser.setAcceptAllFileFilterUsed(false);
+
+		fileChooser.addChoosableFileFilter(new DriverFileFilter());
+		return fileChooser;
+	}
+
+	protected boolean checkStoresCompatibility(RasterDataStore mainRasterStore, List<File> fileList) {
+		for (int i = fileList.size() - 1; i >= 0; i--) {
+			//Checks extents
+			try {
+				if(!checkNewFile(mainRasterStore, fileList.get(i).getAbsolutePath())) {
+					JOptionPane.showMessageDialog(null, Messages.getText("extents_no_coincidentes") +  " " + fileList.get(i).getAbsolutePath(), "", JOptionPane.ERROR_MESSAGE);
+					fileList.remove(i);
+				}
+			} catch (Exception e) {
+				log.debug("Problems check the bounding boxes", e);
+			}
+		}
+
+		if(mainRasterStore.isTiled()) {
+			if(!RasterSwingLibrary.messageBoxYesOrNot(Messages.getText("store_tiled"), this)) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Creates a multifile data provider
+	 * @param layerName
+	 * @param path
+	 * @return
+	 */
+	protected MultiFileProvider createMultiFileProvider(String layerName, String path) {
+		DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager();
+
+		try {
+			//It creates the new Multifile provider
+			DataServerExplorerParameters explParams = dataManager.createServerExplorerParameters(MultiFileProvider.NAME);
+			DataServerExplorer explorer = dataManager.openServerExplorer(MultiFileProvider.NAME, explParams);
+			MultiFileDataParameters newParamsMultifile = (MultiFileDataParameters)dataManager.createStoreParameters(explorer.getProviderName());
+
+			if(!path.endsWith(File.separator))
+				path = path + File.separator;
+			File fileURI = new File(path + layerName + ".mff");
+			File rmfURI = new File(path + layerName + ".rmf");
+			int counter = 0;
+			while(fileURI.exists() || rmfURI.exists()) {
+				fileURI = new File(path + layerName + "_" + counter + ".mff");
+				rmfURI = new File(path + layerName + "_" + counter + ".rmf");
+				counter ++;
+			}
+			if(counter > 0)
+				layerName += "_" + counter;
+
+			newParamsMultifile.setURI(fileURI.toURI());
+
+			return (MultiFileProvider)dataManager.createProvider(null, newParamsMultifile);
+		} catch (Exception exc) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("addband_error"), bandSetupPanel, exc);
+		}
+		return null;
+	}
+
+	/**
+	 * Comprobar si la asignacion de color es correcta para las 4 bandas. No puede
+	 * existir una banda con distintas interpretaciones de color. Se comprueban dos
+	 * casos, asignaciones en escala de grises o en RGB.
+	 * @param r
+	 * @param g
+	 * @param b
+	 * @param a
+	 * @return
+	 */
+	protected boolean isCorrectAssignedBand(int r, int g, int b, int a) {
+		// Si es gris es correcta la asignacion
+		if ((r == g) && (r == b) && (r >= 0)) {
+			// Si el alpha esta asignado a la misma banda es incorrecto
+			if (r == a)
+				return false;
+			// En caso contrario es correcto
+			return true;
+		}
+
+		// Si dos bandas coinciden, se dice que no es correcta la asignacion
+		int list[] = { r, g, b, a };
+		for (int i = 0; i <= 3; i++)
+			for (int j = 0; j <= 3; j++)
+				if ((i != j) && (list[i] == list[j]) && (list[i] > -1))
+					return false;
+
+		return true;
+	}
+
+	/**
+	 * Checks if the new file is compatible with the old one
+	 * @param file
+	 * @return
+	 * @throws LocatorException
+	 * @throws NotSupportedExtensionException
+	 * @throws RasterDriverException
+	 * @throws CloseException
+	 */
+	protected boolean checkNewFile(RasterDataStore oldStore, String file) throws LocatorException, NotSupportedExtensionException, RasterDriverException, CloseException {
+		Rectangle2D extentOrigin = oldStore.getExtent().toRectangle2D();
+
+		ProviderServices provServ = RasterLocator.getManager().getProviderServices();
+		RasterDataParameters storeParameters = provServ.createParameters(file);
+		storeParameters.setSRS(oldStore.getProjection());
+		RasterDataStore dataStore = RasterLocator.getManager().getProviderServices().open(storeParameters);
+
+		Extent extentNewFile = dataStore.getExtent();
+
+		// Comprobamos que el extent y tama�o del fichero a�adido sea igual al
+		// fichero original. Si no es as� no abrimos la capa y mostramos un aviso
+
+		double widthNewFile = (extentNewFile.getMax().getX() - extentNewFile.getMin().getX());
+		double heightNewFile = (extentNewFile.getMax().getY() - extentNewFile.getMin().getY());
+
+		if ((widthNewFile - extentOrigin.getWidth()) > 1.0 || (widthNewFile - extentOrigin.getWidth()) < -1.0 || (heightNewFile - extentOrigin.getHeight()) > 1.0
+				|| (heightNewFile - extentOrigin.getHeight()) < -1.0) {
+			return false;
+		}
+
+		if ((extentNewFile.getMax().getX() - extentNewFile.getMin().getX()) != extentOrigin.getWidth()
+				|| (extentNewFile.getMax().getY() - extentNewFile.getMin().getY()) != extentOrigin.getHeight()) {
+			return false;
+		}
+
+		dataStore.close();
+		return true;
+	}
+
+	/**
+	 * Saves the new layer in disk
+	 * @param layerName
+	 * @param file
+	 * @param uriList
+	 * @return String
+	 * @throws IOException
+	 */
+	protected String saveMultiFileLayer(String layerName, String file, ArrayList<File> uriList) throws IOException {
+		String path = file.substring(0, file.lastIndexOf(File.separator) + 1);
+		path = path + layerName + ".mff";
+
+		/*File filePath = new File(path);
+		if(filePath.exists()) {
+			RasterToolsUtil.messageBoxInfo("file_exists_rename", bandSetupPanel);
+			filePath.renameTo(new File(path + "~"));
+		}*/
+
+		MultiFileFormat format = new MultiFileFormat();
+		for (int i = 0; i < uriList.size(); i++) {
+			format.addFile(uriList.get(i));
+		}
+		format.setName(layerName);
+
+		format.write(path);
+		return path;
+	}
+
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/AbstractBandSelectorListener.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MainDialogActions.java
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MainDialogActions.java	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MainDialogActions.java	(revision 8080)
@@ -0,0 +1,216 @@
+package org.gvsig.raster.multifile.app;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.andami.PluginServices;
+import org.gvsig.andami.ui.mdiManager.IWindow;
+import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.dataset.Buffer;
+import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException;
+import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
+import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.MapContextManager;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
+import org.gvsig.i18n.Messages;
+import org.gvsig.raster.algorithm.RasterBaseAlgorithmLibrary;
+import org.gvsig.raster.algorithm.process.DataProcess;
+import org.gvsig.raster.algorithm.process.IProcessActions;
+import org.gvsig.raster.algorithm.process.ProcessException;
+import org.gvsig.raster.fmap.layers.FLyrRaster;
+import org.gvsig.raster.impl.provider.RasterProvider;
+import org.gvsig.raster.multifile.app.panel.BandSelectorPanel;
+import org.gvsig.raster.multifile.io.MultiFileDataParameters;
+import org.gvsig.raster.multifile.io.MultiFileFormat;
+import org.gvsig.raster.swing.RasterSwingLibrary;
+
+/**
+ * @author gvSIG team
+ *
+ */
+public class MainDialogActions implements IProcessActions {
+	private String                          file                 = null;
+	private String                          folder               = null;
+	private BandSelectorPanel               panel                = null;
+	private AbstractViewPanel               selectedView         = null;
+
+	/**
+	 * @param panel
+	 * @param file
+	 * @param folder
+	 */
+	public MainDialogActions(BandSelectorPanel panel, String file, String folder) {
+		this.file = file;
+		this.folder = folder;
+		this.panel = panel;
+	}
+
+	/**
+	 *
+	 */
+	public void buildOneLayer() {
+		RasterDataStore mainRasterStore = panel.getResult();
+		saveMetadata();
+
+		DataProcess clippingProcess = null;
+		try {
+			clippingProcess = RasterBaseAlgorithmLibrary.getManager().createRasterTask("ClippingProcess");
+		} catch (ProcessException e) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("error_processing_layer"), panel, e);
+		}
+		clippingProcess.setActions(this);
+		String tit = PluginServices.getMDIManager().getWindowInfo(getView()).getTitle();
+		clippingProcess.addParam("viewname", tit);
+		clippingProcess.addParam("pixelcoordinates", new int[] { 0, (int) mainRasterStore.getHeight(), (int) mainRasterStore.getWidth(), 0 });
+		clippingProcess.addParam("resolution", new int[]{(int) mainRasterStore.getWidth(),
+					 										 (int) mainRasterStore.getHeight()});
+		clippingProcess.addParam("suffix", ".tif");
+
+		clippingProcess.addParam("filename", folder + File.separator + file);
+		clippingProcess.addParam("layer", mainRasterStore);
+		int[] drawableBands = new int[mainRasterStore.getBandCount()];
+		for (int i = 0; i < drawableBands.length; i++) {
+			drawableBands[i] = i;
+		}
+		clippingProcess.addParam("drawablebands", drawableBands);
+		clippingProcess.addParam("onelayerperband", new Boolean(false));
+		clippingProcess.addParam("interpolationmethod", new Integer(Buffer.INTERPOLATION_NearestNeighbour));
+		clippingProcess.addParam("affinetransform", mainRasterStore.getAffineTransform());
+
+
+		/*if (params != null)
+			RasterToolsUtil.loadWriterParamsFromPropertiesPanel(panelProperty, params);
+		clippingProcess.addParam("driverparams", params);*/
+		clippingProcess.start();
+	}
+
+	/**
+	 *
+	 */
+	public void loadLayer() {
+		RasterDataStore mainRasterStore = panel.getResult();
+		if(mainRasterStore == null) {
+			return;
+		}
+
+		saveMff(mainRasterStore);
+		saveMetadata();
+		try {
+			loadLayerInView(mainRasterStore);
+		} catch (LoadLayerException e) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("error_loading_layer"), panel, e);
+		}
+	}
+
+	private void saveMff(RasterDataStore mainRasterStore) {
+		MultiFileDataParameters params = (MultiFileDataParameters)mainRasterStore.getParameters();
+		ArrayList<File> uriList = new ArrayList<File>();
+		List<RasterProvider> providers = params.getProviders();
+		for (int i = 0; i < providers.size(); i++) {
+			uriList.add(new File(providers.get(i).getURI()));
+		}
+		try {
+			MultiFileFormat.saveMultiFileFormat(file, folder, uriList);
+		} catch (IOException e) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_mff"), panel, e);
+		}
+	}
+
+	private void saveMetadata() {
+		RasterDataStore mainRasterStore = panel.getResult();
+		int rBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND);
+		int gBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.GREEN_BAND);
+		int bBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.BLUE_BAND);
+		int aBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND);
+
+		if (!isCorrectAssignedBand(rBand, gBand, bBand, aBand)) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("combinacion_no_asignable"), panel);
+			return;
+		}
+
+		try {
+			ColorInterpretation ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation(
+					new String[mainRasterStore.getBandCount()]);
+			// Combinaci�n GRAY
+			if ((rBand == gBand) && (rBand == bBand) && (rBand >= 0)) {
+				for (int iBand = 0; iBand < panel.getARGBTable().getRowCount(); iBand++) {
+					ci.setColorInterpValue(iBand, ColorInterpretation.UNDEF_BAND);
+				}
+				ci.setColorInterpValue(rBand, ColorInterpretation.GRAY_BAND);
+				ci.setColorInterpValue(aBand, ColorInterpretation.ALPHA_BAND);
+			} else {
+				// Combinaci�n RGB
+				ci.setColorInterpValue(aBand, ColorInterpretation.ALPHA_BAND);
+				ci.setColorInterpValue(rBand, ColorInterpretation.RED_BAND);
+				ci.setColorInterpValue(gBand, ColorInterpretation.GREEN_BAND);
+				ci.setColorInterpValue(bBand, ColorInterpretation.BLUE_BAND);
+			}
+			RasterLocator.getManager().getProviderServices().saveObjectToRmfFile(folder + File.separator + file, ci);
+		} catch (RmfSerializerException exc) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_rmf"), panel, exc);
+		} catch (NotInitializeException exc) {
+			RasterSwingLibrary.messageBoxError(Messages.getText("table_not_initialize"), panel, exc);
+		}
+	}
+
+	private void loadLayerInView(RasterDataStore mainRasterStore) throws LoadLayerException {
+		MapContextManager mcm = MapContextLocator.getMapContextManager();
+		FLyrRaster lyr = (FLyrRaster) mcm.createLayer(file, mainRasterStore);
+		lyr.reload();
+
+		getView().getMapControl().getMapContext().beginAtomicEvent();
+		getView().getMapControl().getMapContext().getLayers().addLayer(lyr);
+		getView().getMapControl().getMapContext().invalidate();
+		getView().getMapControl().getMapContext().endAtomicEvent();
+	}
+
+	private AbstractViewPanel getView() {
+		if(selectedView == null) {
+			IWindow[] wList = PluginServices.getMDIManager().getAllWindows();
+			for (int i = 0; i < wList.length; i++) {
+				if(wList[i] instanceof AbstractViewPanel)
+					selectedView = (AbstractViewPanel)wList[i];
+			}
+		}
+		return selectedView;
+	}
+
+	private boolean isCorrectAssignedBand(int r, int g, int b, int a) {
+		// Si es gris es correcta la asignacion
+		if ((r == g) && (r == b) && (r >= 0)) {
+			// Si el alpha esta asignado a la misma banda es incorrecto
+			if (r == a)
+				return false;
+			// En caso contrario es correcto
+			return true;
+		}
+
+		// Si dos bandas coinciden, se dice que no es correcta la asignacion
+		int list[] = { r, g, b, a };
+		for (int i = 0; i <= 3; i++)
+			for (int j = 0; j <= 3; j++)
+				if ((i != j) && (list[i] == list[j]) && (list[i] > -1))
+					return false;
+
+		return true;
+	}
+
+	public void interrupted() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void end(Object param) {
+
+	}
+
+	public void updateProgress(int current, int total) {
+		// TODO Auto-generated method stub
+
+	}
+}

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MainDialogActions.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/config.xml
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/config.xml	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/config.xml	(revision 8080)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<plugin-config>
+  <depends plugin-name="org.gvsig.raster.mainplugin" />
+  <depends plugin-name="org.gvsig.raster.tilecache.app" optional="true" />
+  <resourceBundle name="text" />
+  <libraries library-dir="lib" />
+  <extensions>
+    <extension class-name="org.gvsig.raster.multifile.app.MultifileClientExtension"
+      description="Support for raster multiband and multifile" active="true"
+      priority="1">
+
+      <!-- <menu text="Layer/dataset_raster/create_multifile" name="raster-tools-multifile"/>
+        <action name="raster-tools-multifile" label="create_multifile" action-command="MultifileCreator"
+        icon="multifile-icon" position="000601500" accelerator="" /> -->
+    </extension>
+  </extensions>
+</plugin-config>

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/config.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/images/multifile-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/images/multifile-icon.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text.properties
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text.properties	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text.properties	(revision 8080)
@@ -0,0 +1,22 @@
+store_tiled=La capa actual est� tileada.\n Para a�adir ficheros a ella se convertir� a no tileada.
+combinacion_no_asignable=No es posible guardar esa combinaci�n de bandas por defecto.\n Una banda solo puede tener una interpretaci�n de color.
+color_interpretation_continue=Se va a cambiar la interpretaci�n de color por defecto para su raster. �Desea continuar?
+error_carga_capa=Error en la carga de la capa.
+error_salvando_rmf=Error escribiendo el fichero rmf
+table_not_initialize=Tabla no inicializada
+fichero_existe=El fichero existe en el dataset
+extents_no_coincidentes=La extensi�n de las capas no coinciden
+addband_error=No se pudo a�adir las bandas del fichero seleccionado al dataset
+anadir=A�adir
+eliminar=Eliminar
+bands_panel=Bandas
+bands=Bandas
+save=Salvar
+save_color_interpretation=Salvar la interpretaci�n de color
+layer_name=Nombre de capa
+character_not_valid=Caracter no valido
+create_multifile=Crear capa multifichero
+load_layer=Cargar capa
+generate_file=Generar fichero
+select_output_file=Capa de salida
+add_files=A�adir ficheros
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text_en.properties
===================================================================
--- org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text_en.properties	(revision 0)
+++ org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text_en.properties	(revision 8080)
@@ -0,0 +1,22 @@
+store_tiled=The current layer is tiled.\n To add files will be turned into not tiled.
+combinacion_no_asignable=It's not possible to save this selection of bands as default.\n A band only can to have one color interpretation
+color_interpretation_continue=It's going to change default color interpretationlor for this raster. Would you like to go on?
+error_carga_capa=Error loading layer
+error_salvando_rmf=Error writing in rmf file
+table_not_initialize=Table not initialize
+fichero_existe=Selected file already exists as layer band
+extents_no_coincidentes=Extent of the selected image does not match with the origin image.
+addband_error=Bands haven't been added to selected dataset.
+anadir=Add
+eliminar=Remove
+bands_panel=Bands
+bands=Bands
+save=Save
+save_color_interpretation=Save color interpretation
+layer_name=Layer name
+character_not_valid=Character not valid
+create_multifile=Create layer multifile
+load_layer=Load layer
+generate_file=Builds a file
+select_output_file=Output layer
+add_files=Add files
\ No newline at end of file

Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text_en.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: org.gvsig.raster.multifile/tags/org.gvsig.raster.multifile-2.2.59/org.gvsig.raster.multifile.app.multifileclient
___________________________________________________________________
Added: svn:ignore
   + target

.settings

.project

.classpath


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

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


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


