Revision 31535

View differences:

tags/tmp_build/libraries/libPersonalDB/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
	<classpathentry kind="var" path="GVSIG_INSTALL_DIR/bin/lib/org.gvsig.tools.jar" sourcepath="/libToolsDIR"/>
6
	<classpathentry kind="lib" path="lib/h2-1.1.101.jar"/>
7
	<classpathentry kind="output" path="bin"/>
8
</classpath>
tags/tmp_build/libraries/libPersonalDB/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>libPersonalDB</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
	</buildSpec>
14
	<natures>
15
		<nature>org.eclipse.jdt.core.javanature</nature>
16
	</natures>
17
</projectDescription>
tags/tmp_build/libraries/libPersonalDB/src/org/gvsig/personaldb/PersonalDBManager.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 Geographic Information research group: http://www.geoinfo.uji.es
26
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI)
27
* Universitat Jaume I   
28
* {{Task}}
29
*/
30

  
31
package org.gvsig.personaldb;
32

  
33
import java.sql.Connection;
34

  
35
public interface PersonalDBManager {
36

  
37
	/**
38
	 * Retrieve the Personal Data Base Connection 
39
	 * @return	an Connection object
40
	 */
41
	public Connection getConnection();
42
	
43
}
tags/tmp_build/libraries/libPersonalDB/src/org/gvsig/personaldb/H2DBManager.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 Geographic Information research group: http://www.geoinfo.uji.es
26
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI)
27
* Universitat Jaume I   
28
* {{Task}}
29
*/
30

  
31
package org.gvsig.personaldb;
32

  
33
import java.sql.Connection;
34
import java.sql.DriverManager;
35
import java.sql.SQLException;
36

  
37

  
38

  
39
public class H2DBManager implements PersonalDBManager {
40
	
41
	private Connection conn = null;
42

  
43
	public Connection getConnection() {
44
		
45
		if(conn == null) {
46
			
47
			try {
48
				Class.forName("org.h2.Driver");
49
				conn = DriverManager.getConnection("jdbc:h2:~/gvSIG/gvSIGpersonalDB", "gvsig", "personaldb"); 
50
			} catch (ClassNotFoundException e) {
51
				// TODO Auto-generated catch block
52
				e.printStackTrace();
53
			} catch (SQLException e) {
54
				// TODO Auto-generated catch block
55
				e.printStackTrace();
56
			}
57
			
58
		}
59
		return conn;
60
		
61
	}
62
	
63
}
tags/tmp_build/libraries/libPersonalDB/src/org/gvsig/personaldb/PersonalDBLocator.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 Geographic Information research group: http://www.geoinfo.uji.es
26
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI)
27
* Universitat Jaume I   
28
* {{Task}}
29
*/
30

  
31
package org.gvsig.personaldb;
32

  
33
import org.gvsig.tools.locator.AbstractLocator;
34
import org.gvsig.tools.locator.LocatorException;
35

  
36

  
37
public class PersonalDBLocator extends AbstractLocator {
38

  
39
	public static final String PERSONAL_DB_MANAGER_NAME = "PersonalDBManager";
40

  
41
	private static final String LOCATOR_NAME = "PersonalDBLocator";
42
	
43
	private static final String PERSONAL_DB_MANAGER_DESCRIPTION = "Compatible implementation for PersonalDBManager";
44

  
45
	
46
	
47
	/**
48
     * Unique instance.
49
     */
50
    private static final PersonalDBLocator instance = new PersonalDBLocator();
51

  
52
    /**
53
     * Return the singleton instance.
54
     * 
55
     * @return the singleton instance
56
     */
57
    public static PersonalDBLocator getInstance() {
58
        return instance;
59
    }
60
	
61
	/**
62
     * Return a reference to PersonalDBManager.
63
     * 
64
     * @return a reference to PersonalDBManager
65
     * @throws LocatorException
66
     *             if there is no access to the class or the class cannot be
67
     *             instantiated
68
     * @see Locator#get(String)
69
     */
70
    public static PersonalDBManager getPersonalDBManager() throws LocatorException {
71
        return (PersonalDBManager) getInstance().get(PERSONAL_DB_MANAGER_NAME);
72
    }
73
    
74
    /**
75
     * Registers the Class implementing the PersonalDBManager interface.
76
     * 
77
     * @param clazz
78
     *            implementing the PersonalDBManager interface
79
     */
80
    public static void registerPersonalDBManager(Class clazz) {
81
        getInstance().register(PERSONAL_DB_MANAGER_NAME, PERSONAL_DB_MANAGER_DESCRIPTION, clazz);
82
    }
83

  
84
    public String getLocatorName() {
85
        return LOCATOR_NAME;
86
    }
87
	
88
}
tags/tmp_build/libraries/libPersonalDB/src/org/gvsig/personaldb/PersonalDBLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 Geographic Information research group: http://www.geoinfo.uji.es
26
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI)
27
* Universitat Jaume I   
28
* {{Task}}
29
*/
30

  
31
package org.gvsig.personaldb;
32

  
33

  
34
import org.gvsig.tools.locator.BaseLibrary;
35
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
36

  
37
public class PersonalDBLibrary extends BaseLibrary {
38
	
39
	public void initialize() {
40
        super.initialize();
41
        PersonalDBLocator.registerPersonalDBManager(H2DBManager.class);
42
    }
43

  
44
	public void postInitialize() {
45
		super.postInitialize();
46
		
47
		 // Validate there is any implementation registered.
48
        PersonalDBManager manager = PersonalDBLocator.getPersonalDBManager();
49

  
50
        if (manager == null) {
51
            throw new ReferenceNotRegisteredException(
52
                    PersonalDBLocator.PERSONAL_DB_MANAGER_NAME, PersonalDBLocator.getInstance());
53
        }
54
    }
55
	
56
}
tags/tmp_build/libraries/libPersonalDB/.settings/org.eclipse.jdt.core.prefs
1
#Thu Oct 30 11:34:14 CET 2008
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6
org.eclipse.jdt.core.compiler.compliance=1.6
7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12
org.eclipse.jdt.core.compiler.source=1.5
tags/tmp_build/libraries/libPersonalDB/.settings/org.eclipse.jdt.ui.prefs
1
#Thu Oct 30 11:37:11 CET 2008
2
eclipse.preferences.version=1
3
internal.default.compliance=user
tags/tmp_build/libraries/libPersonalDB/build.xml
1
<project name="libPersonalDB" default="generate-without-source" basedir=".">
2
   <description>
3
       Instala la libreria libPersonalDB (temporalmente sobre la extensión).
4
   </description>
5
 <!-- set global properties for this build -->
6
 <property name="src" location="src"/>
7
 <property name="build" location="bin"/>
8
 <property name="dist"  location="dist"/>
9
 <property name="plugin" value="org.gvsig.personaldb"/>
10
 <property name="extension-dir" location="../extMetadata"/>
11

  
12
 <target name="init">
13
   <!-- Create the time stamp -->
14
   <tstamp/>
15
   <!-- Create the build directory structure used by compile -->
16
   <mkdir dir="${build}"/>
17
   <mkdir dir="${dist}"/>
18
       <!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
19
       <buildnumber/> 
20
       
21
 </target>
22

  
23
 <target name="generate-without-source" description="generate the distribution without the source file" >
24
   <!-- Create the distribution directory -->
25
   <mkdir dir="${dist}"/>
26

  
27
   <jar jarfile="${dist}/${plugin}.jar" basedir="${build}"/>
28

  
29
   <copy todir="${dist}">
30
      <fileset dir="lib" includes="*.jar"/>
31
   </copy>
32
  
33
   <move todir="${extension-dir}/lib">
34
       <fileset dir="${dist}" includes="**/**"/>
35
   </move>
36
 </target>
37
</project>
tags/tmp_build/libraries/libCresques/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>libCresques</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
	</buildSpec>
14
	<natures>
15
		<nature>org.eclipse.jdt.core.javanature</nature>
16
	</natures>
17
</projectDescription>
0 18

  
tags/tmp_build/libraries/libCresques/src/org/cresques/filter/PixelFilter.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.filter;
25

  
26

  
27
/**
28
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
29
 */
30
public class PixelFilter {
31
    public boolean debug = false;
32
    int transparente = 0x10ffff00;
33
    int orColor = 0xff000000;
34
    int umbral = 0xf0f0f0;
35
    private int alpha = 0xff;
36

  
37
    /**
38
     * Constructor para el Oleico
39
     */
40
    public PixelFilter(int alpha) {
41
        transparente = 0x10ffff00;
42
        setAlpha(alpha);
43

  
44
        //orColor = 0xff000000 | (alpha * 0x1000000);
45
        umbral = 0xf0f0f0;
46
    }
47

  
48
    /**
49
     * Constructor.
50
     *
51
     * @param trans Color que sustituye a los pixeles filtrados
52
     * @param or        M?scara que se aplica a los pixeles restantes
53
     * @param pxMax        Umbral que determina los pixeles.
54
     */
55
    public PixelFilter(int trans, int or, int pxMax) {
56
        transparente = trans;
57
        setAlpha((orColor >> 24) & 0xff);
58
        orColor = or;
59
        umbral = pxMax;
60
    }
61

  
62
    public void setAlpha(int alpha) {
63
        this.alpha = alpha;
64
        orColor = (alpha << 24) & 0xff000000;
65
    }
66

  
67
    public int getAlpha() {
68
        return alpha;
69
    }
70

  
71
    /**
72
     * Filtra una l?nea de pixeles.
73
     *
74
     * @param pRGBArray
75
     */
76
    public void filterLine(int[] pRGBArray) {
77
        for (int i = 0; i < pRGBArray.length; i++) {
78
            /*if (debug)
79
                    System.out.print(""+i+":"+Integer.toHexString(pRGBArray[i])+",");*/
80
            if (pRGBArray[i] >= umbral) {
81
                pRGBArray[i] = transparente;
82
            } else {
83
                pRGBArray[i] |= orColor;
84
            }
85
        }
86

  
87
        /*if (debug)
88
                System.out.println("");*/
89
    }
90
}
0 91

  
tags/tmp_build/libraries/libCresques/src/org/cresques/filter/IRaster.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.filter;
25

  
26
import java.awt.image.DataBuffer;
27

  
28

  
29
/**
30
 * Raster con acceso a los elementos individuales (pixeles o datos de celda).
31
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
32
 */
33
public interface IRaster {
34
    public final static int TYPE_UNDEFINED = DataBuffer.TYPE_UNDEFINED;
35
    public final static int TYPE_BYTE = DataBuffer.TYPE_BYTE;
36
    public final static int TYPE_SHORT = DataBuffer.TYPE_SHORT;
37
    public final static int TYPE_USHORT = DataBuffer.TYPE_USHORT;
38
    public final static int TYPE_INT = DataBuffer.TYPE_INT;
39
    public final static int TYPE_FLOAT = DataBuffer.TYPE_FLOAT;
40
    public final static int TYPE_DOUBLE = DataBuffer.TYPE_DOUBLE;
41
    public final static int TYPE_IMAGE = -1;
42

  
43
    /**
44
     * Ancho del raster
45
     * @return Entero con el ancho del raster
46
     */
47
    public int getWidth();
48

  
49
    /**
50
     * Alto del raster
51
     * @return Entero con el alto del raster
52
     */
53
    public int getHeight();
54

  
55
    /**
56
     * N?mero de bandas
57
     * @return Entero con el n?mero de bandas
58
     */
59
    public int getBandNr();
60

  
61
    /**
62
     * Devuelve el tipo de datos del raster
63
     * @see java.awt.image.DataBuffer
64
     */
65
    public int getDataType();
66

  
67
    /**
68
     * Obtiene sobre un array de bandas el valor del raster en la
69
     * coordenada que se le pasa. Los elementos son de 16 bits.
70
     * @param x        coordenada X
71
     * @param y coordenada Y
72
     * @param px Array de 4 elementos para las bandas de la imagen ARGB
73
     */
74
    public void getElemShort(int x, int y, int[] px);
75

  
76
    /**
77
     * Obtiene sobre un array de bandas el valor del raster en la
78
     * coordenada que se le pasa. Los elementos son de 32 bits.
79
     * @param x        coordenada X
80
     * @param y coordenada Y
81
     * @param px Array de 4 elementos para las bandas de la imagen ARGB
82
     */
83
    public void getElemInt(int x, int y, int[] px);
84

  
85
    /**
86
     * Obtiene el valor del raster en la coordenada que se le pasa.
87
     * Devuelve un int.
88
     * @param x        coordenada X
89
     * @param y coordenada Y
90
     * @param band banda
91
     * @return Entero
92
     */
93
    public int getElemInt(int x, int y, int band);
94
}
0 95

  
tags/tmp_build/libraries/libCresques/src/org/cresques/filter/Transparency/TransparencyRange.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.filter.Transparency;
25

  
26
import java.io.IOException;
27

  
28
	/**
29
	 * Clase que representa a un conjunto de pixeles con
30
	 * transparencia. Incluye los rangos de transparencia para cada banda, 
31
	 * la cadena que va en la lista y la operaci?n que se realiza entre 
32
	 * ellos. Un And significa que ser?n transparentes todos los pixeles
33
	 * que cumplan con R con G y con B. Un Or significar? que tendr?n transparencia
34
	 * todos los pixeles que cumplan con R con G o con B.  
35
	 * @author Nacho Brodin (brodin_ign@gva.es)
36
	 *
37
	 */
38
	public class TransparencyRange{
39
		private String 	strEntry = null;
40
		private int[]	red = null;
41
		private int[]	green = null;
42
		private int[]	blue = null;
43
		private boolean	and = true;
44
		
45
		/**
46
		 * Obtiene la operaci?n  utilizada
47
		 * @param and Si es true significa que se usa un AND y false implica
48
		 * que se usa un OR
49
		 */
50
		public boolean isAnd() {
51
			return and;
52
		}
53
		
54
		/**
55
		 * Asigna la operaci?n AND como la utilizada
56
		 * @param and booleano que si est? a true significa que el la operaci?n
57
		 * AND es la utilizada como operaci?n.
58
		 */
59
		public void setAnd(boolean and) {
60
			this.and = and;
61
		}
62
		
63
		/**
64
		 * Obtiene el intervalo de valores correspondiente a la banda del azul
65
		 * @return Array bidimensional de enteros correspondiente a la banda del azul
66
		 */
67
		public int[] getBlue() {
68
			return blue;
69
		}
70
		
71
		/**
72
		 * Asigna el intervalo de valores correspondiente a la banda del azul
73
		 * @param blue Array bidimensional de enteros correspondiente a la banda del azul
74
		 */
75
		public void setBlue(int[] blue) {
76
			this.blue = blue;
77
		}
78
		
79
		/**
80
		 * Obtiene el intervalo de valores correspondiente a la banda del verde
81
		 * @return Array bidimensional de enteros correspondiente a la banda del verde
82
		 */
83
		public int[] getGreen() {
84
			return green;
85
		}
86
		
87
		/**
88
		 * Asigna el intervalo de valores correspondiente a la banda del verde
89
		 * @param green Array bidimensional de enteros correspondiente a la banda del verde
90
		 */
91
		public void setGreen(int[] green) {
92
			this.green = green;
93
		}
94
		
95
		/**
96
		 * Obtiene el intervalo de valores correspondiente a la banda del rojo
97
		 * @return Array bidimensional de enteros correspondiente a la banda del rojo
98
		 */
99
		public int[] getRed() {
100
			return red;
101
		}
102
		
103
		/**
104
		 * Asigna el intervalo de valores correspondiente a la banda del rojo
105
		 * @param red Array bidimensional de enteros correspondiente a la banda del rojo
106
		 */
107
		public void setRed(int[] red) {
108
			this.red = red;
109
		}
110
		
111
		/**
112
		 * Obtiene la cadena que representa una entrada en la tabla.
113
		 * @return Cadena que representa una entrada en la tabla
114
		 */
115
		public String getStrEntry() {
116
			return strEntry;
117
		}
118
		
119
		/**
120
		 * Asigna la cadena que representa una entrada en la tabla.
121
		 * @param strEntry Cadena que representa una entrada en la tabla.
122
		 */
123
		public void setStrEntry(String strEntry) {
124
			this.strEntry = strEntry;
125
		}
126
		
127
		
128
		/**
129
		 * Esta funci?n valida la cadena de entrada por medio de una m?quina de estados. Valida las
130
		 * siguientes posibilidades en la cadena de entrada:
131
		 * <LI>
132
		 * <UL>(valor_rojo) & (Valor_verde) & (Valor_azul)</UL>
133
		 * <UL>(valor_rojo) | (Valor_verde) | (Valor_azul)</UL>
134
		 * </LI>
135
		 * Despues de la validaci?n parsea el contenido y carga los par?metros r,g,b con los
136
		 * intervalos de valores. Estos par?metros deben ser pasados como arrays de enteros de 
137
		 * dos elementos.  
138
	     * @param values
139
	     * @param r	Intervalo de rojo
140
	     * @param g Intervalo de verde
141
	     * @param b Intervalo de azul
142
	     * @return Devuelve true si la operaci?n usada en los intervalos es un AND y false si es un OR
143
	     */
144
		public static boolean stringToInterval(String values, int[] r, int[] g, int[] b) throws IOException {
145
			int status = 0;
146
		    int countAnd = 0, countOr = 0;
147
		    boolean and = true;
148
		    for(int i=0;i<values.length();i++){
149
		      char c = values.charAt(i);
150
		      switch(status){
151
		      case 0: 	if(c == ' ')status = 0;
152
		      			else if ((c >= 48 && c <= 57) || c == '*')status = 1;
153
     					else status = 4;
154
     					break;
155
		      case 1: 	if ((c >= 48 && c <= 57) || (c == ' '))status = 1;
156
     					else if(c == ':') status = 2;
157
     					else if(c == '&'){
158
							status = 0;
159
							countAnd++;
160
		    	   		}else if(c == '|'){
161
							status = 0;
162
							countOr++;
163
		    	   		}else status = 4;
164
     					break;
165
		      case 2:	if (c >= 48 && c <= 57) status = 3;
166
		      			else status = 4;
167
		      			break;
168
		      case 3: 	if ((c >= 48 && c <= 57) || (c == ' '))status = 3;
169
		      			else if(c == '&'){
170
		      				status = 0;
171
		      				countAnd++;
172
		      			}else if(c == '|'){
173
		      				status = 0;
174
		      				countOr++;
175
		      			}else status = 4;
176
						break;
177
		      case 4:	throw new IOException("Error en la cadena de entrada "+status);
178
		      }
179
		    }
180
		    	
181
		    //Si el analisis es correcto parseamos
182
		    if((status == 1 || status ==3) && ((countAnd == 2 && countOr == 0)  || 
183
		    					(countAnd == 0 && countOr == 2)) ){
184
		    	  String[] s = values.split(" & ");
185
				  if(s.length < 3){
186
					  s = values.split(" \\| ");
187
					  and = false;
188
				  }
189
				  ;
190
				String[] val = s[0].split(":");
191
				try{
192
					r[0] = Integer.parseInt(val[0]);
193
				 	if(val.length == 2)
194
				 		r[1] = Integer.parseInt(val[1]);
195
				 	else
196
						r[1] = Integer.parseInt(val[0]);
197
				}catch(NumberFormatException e){
198
					r [0] = -1;r [1] = -1;
199
				}
200
				 
201
				val = s[1].split(":");
202
				try{
203
				  	g[0] = Integer.parseInt(val[0]);
204
					if(val.length == 2)
205
						g[1] = Integer.parseInt(val[1]);
206
					else
207
						g[1] = Integer.parseInt(val[0]);
208
				}catch(NumberFormatException e){
209
					g[0] = -1;g[1] = -1;
210
				}
211
				  
212
				val = s[2].split(":");
213
				try{
214
					b[0] = Integer.parseInt(val[0]);
215
					if(val.length == 2)
216
						b[1] = Integer.parseInt(val[1]);
217
					else
218
						b[1] = Integer.parseInt(val[0]);  
219
				}catch(NumberFormatException e){
220
					b [0] = -1;b [1] = -1;
221
				}
222
		  }else
223
			 throw new IOException("Error en la cadena de entrada ");
224
		      
225
		  return and;
226
		}
227
	    
228
		/**
229
		 * Carga la cadena StrEntry leyendo los valores en los vectores que representa los intervalos.
230
		 */
231
		public void loadStrEntryFromValues(){
232
			String separator = " | ";
233
			if(and)
234
				separator = " & ";
235
			strEntry = String.valueOf(red[0] + separator+ green[0] + separator + blue[0]);
236
		}
237
		
238
		/**
239
		 * Muestra los datos del objeto para depuraci?n.
240
		 */
241
		public void show(){
242
			if(getRed() != null)
243
				System.out.println(getRed()[0]+" "+getRed()[1]);
244
			if(getGreen() != null)
245
				System.out.println(getGreen()[0]+" "+getGreen()[1]);
246
			if(getBlue() != null)
247
				System.out.println(getBlue()[0]+" "+getBlue()[1]);
248
			System.out.println(isAnd());
249
			System.out.println(getStrEntry());
250
			System.out.println("--------------------");
251
		}
252
	}
0 253

  
tags/tmp_build/libraries/libCresques/src/org/cresques/filter/RasterBuf.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.filter;
25

  
26
import java.awt.Point;
27

  
28

  
29
/**
30
 * Rectangulo de pixeles. parecido a java.awt.image.Raster
31
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
32
 */
33
public class RasterBuf implements IRaster {
34
    private byte[][][] byteBuf;
35
    private short[][][] shortBuf;
36
    private int[][][] intBuf;
37
    private int width;
38
    private int height;
39
    private int bandNr;
40
    private int dataType;
41

  
42
    /**
43
     * Constructor
44
     * @param dataType Tipo de dato
45
     * @param width Ancho
46
     * @param height Alto
47
     * @param bandNr Banda
48
     * @param orig
49
     */
50
    public RasterBuf(int dataType, int width, int height, int bandNr, Point orig) {
51
        this.dataType = dataType;
52
        this.width = width;
53
        this.height = height;
54
        this.bandNr = bandNr;
55

  
56
        if (dataType == TYPE_BYTE) {
57
            byteBuf = new byte[height][width][bandNr];
58
        } else if ((dataType == TYPE_SHORT) | (dataType == TYPE_USHORT)) {
59
            shortBuf = new short[height][width][bandNr];
60
        } else if (dataType == TYPE_INT) {
61
            intBuf = new int[height][width][bandNr];
62
        }
63
    }
64

  
65
    /* (non-Javadoc)
66
     * @see org.cresques.io.raster.IRaster#getWidth()
67
     */
68
    public int getWidth() {
69
        return width;
70
    }
71

  
72
    /* (non-Javadoc)
73
     * @see org.cresques.io.raster.IRaster#getHeight()
74
     */
75
    public int getHeight() {
76
        return height;
77
    }
78

  
79
    /* (non-Javadoc)
80
     * @see org.cresques.io.raster.IRaster#getBandNr()
81
     */
82
    public int getBandNr() {
83
        return bandNr;
84
    }
85

  
86
    /* (non-Javadoc)
87
     * @see org.cresques.io.raster.IRaster#getDataType()
88
     */
89
    public int getDataType() {
90
        return dataType;
91
    }
92

  
93
    /**
94
     * Obtiene el tipo de dato
95
     * @return Tipo de dato
96
     */
97
    public int getDataSize() {
98
        if (dataType == TYPE_BYTE) {
99
            return 1;
100
        } else if ((dataType == TYPE_SHORT) | (dataType == TYPE_USHORT)) {
101
            return 2;
102
        } else if (dataType == TYPE_INT) {
103
            return 4;
104
        }
105

  
106
        return 0;
107
    }
108

  
109
    /**
110
     * Obtiene el tama?o del buffer
111
     * @return tama?o del buffer
112
     */
113
    public int sizeof() {
114
        return getDataSize() * width * height * bandNr;
115
    }
116

  
117
    public byte[][] getLineByte(int y) {
118
        return byteBuf[y];
119
    }
120

  
121
    public short[][] getLineShort(int y) {
122
        return shortBuf[y];
123
    }
124

  
125
    public int[][] getLineInt(int y) {
126
        return intBuf[y];
127
    }
128

  
129
    public void getElemShort(int x, int y, int[] px) {
130
        for (int i = 0; i < bandNr; i++)
131
            px[i] = shortBuf[y][x][i];
132
    }
133

  
134
    public void getElemInt(int x, int y, int[] px) {
135
        for (int i = 0; i < bandNr; i++)
136
            px[i] = intBuf[y][x][i];
137
    }
138

  
139
    public void setElemShort(int x, int y, int[] px) {
140
        for (int i = 0; i < bandNr; i++)
141
            shortBuf[y][x][i] = (short) px[i];
142
    }
143

  
144
    public void setElemInt(int x, int y, int[] px) {
145
        for (int i = 0; i < bandNr; i++)
146
            intBuf[y][x][i] = px[i];
147
    }
148

  
149
    /* (non-Javadoc)
150
     * @see org.cresques.io.raster.IRaster#getElemInt(int, int, int)
151
     */
152
    public int getElemInt(int x, int y, int band) {
153
        return intBuf[y][x][band];
154
    }
155

  
156
    /**
157
     * Convierte un tipo de dato a cadena
158
     * @param type Tipo de dato
159
     * @return cadena  que representa el tipo de dato
160
     */
161
    public static String typesToString(int type) {
162
        switch (type) {
163
        case RasterBuf.TYPE_IMAGE:
164
            return new String("Image");
165

  
166
        case RasterBuf.TYPE_BYTE:
167
            return new String("Byte");
168

  
169
        case RasterBuf.TYPE_DOUBLE:
170
            return new String("Double");
171

  
172
        case RasterBuf.TYPE_FLOAT:
173
            return new String("Float");
174

  
175
        case RasterBuf.TYPE_INT:
176
        case RasterBuf.TYPE_USHORT:
177
        case RasterBuf.TYPE_SHORT:
178
            return new String("Short");
179
        }
180

  
181
        return null;
182
    }
183
}
0 184

  
tags/tmp_build/libraries/libCresques/src/org/cresques/filter/SimplePixelFilter.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.filter;
25

  
26

  
27
/**
28
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
29
 */
30
public class SimplePixelFilter extends PixelFilter {
31
    public SimplePixelFilter(int alpha) {
32
        super(alpha);
33
    }
34

  
35
    public void filterLine(int[] pRGBArray) {
36
        for (int i = 0; i < pRGBArray.length; i++) {
37
            if (debug) {
38
                System.out.print("" + i + ":" +
39
                                 Integer.toHexString(pRGBArray[i]) + ",");
40
            }
41

  
42
            pRGBArray[i] |= orColor;
43
        }
44

  
45
        if (debug) {
46
            System.out.println("");
47
        }
48
    }
49
}
0 50

  
tags/tmp_build/libraries/libCresques/src/org/cresques/io/EcwFile.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.io;
25

  
26
import java.awt.Dimension;
27
import java.awt.Image;
28
import java.awt.Point;
29
import java.awt.image.BufferedImage;
30
import java.awt.image.PixelGrabber;
31
import java.io.File;
32

  
33
import org.cresques.cts.ICoordTrans;
34
import org.cresques.cts.IProjection;
35
import org.cresques.px.Extent;
36

  
37
import com.ermapper.ecw.JNCSFile;
38
import com.ermapper.ecw.JNCSFileNotOpenException;
39
import com.ermapper.ecw.JNCSInvalidSetViewException;
40
import com.ermapper.ecw.JNCSProgressiveUpdate;
41
import com.ermapper.util.JNCSDatasetPoint;
42
import com.ermapper.util.JNCSWorldPoint;
43

  
44

  
45
/**
46
 * Soporte para los ficheros .ecw de ErMapper.
47
 * <br>
48
 * NOTA: El SDK que ermapper ha puesto a disposici?n del p?blico en java
49
 * es una versi?n 2.45, de 19/11/2001. Est? implementada usando JNI que
50
 * se apoya en tres librer?as din?micas (dll), y presenta deficiencias
51
 * muy graves a la hora de acceder a la informaci?n. Hasta el momento
52
 * hemos detectado 3 de ellas:<BR>
53
 *     1?.- No soporta ampliaciones superiores a 1:1. si se intenta acceder
54
 * a un ecw con un zoom mayor da una excepci?n del tipo
55
 * com.ermapper.ecw.JNCSInvalidSetViewException, que de no ser tenida encuenta
56
 * acaba tirando abajo la m?quina virtual de java.<BR>
57
 *     2?.- La longitud m?xima de l?nea que adminte el m?todo readLineRGBA es
58
 * de unos 2500 pixeles, lo que hace el uso para la impresi?n en formatos
59
 * superiorea a A4 a 300 ppp o m?s inviable.<BR>
60
 *     3?.- La actualizaci?n progresiva usando el interface JNCSProgressiveUpdate
61
 * con el JNCSFile hace que el equipo genere un error severo y se apague. Este
62
 * error imposibilita esta t?cnica de acceso a ECW.<BR>
63
 * <br>
64
 * Para saltarnos la limitaci?n del bug#1 pedimos la ventana correspondiente al zoom 1:1 para
65
 * el view que nos han puesto, y la resizeamos al tama?o que nos pide el usuario.<br>
66
 * Como consecuencia del bug#2, para tama?os de ventana muy grandes (los necesarios
67
 * para imprimir a m?s de A4 a 300DPI), hay que hacer varias llamadas al fichero con
68
 * varios marcos contiguos, y los devolvemos 'pegados' en una sola imagen (esto se
69
 * realiza de manera transparente para el usuario dentro de la llamada a updateImage.<br>
70
 *
71
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
72
 */
73
public class EcwFile extends GeoRasterFile implements JNCSProgressiveUpdate {
74
		//Lleva la cuenta del n?mero de actualizaciones que se hace de una imagen que corresponde con el
75
		//n?mero de bandas que tiene. Esto es necesario ya que si una imagen tiene el mustResize a
76
		//true solo debe llamar a la funci?n resizeImage al actualizar la ?ltima banda, sino al hacer
77
		//un zoom menor que 1:1 se veria mal
78
		private static int nUpdate = 0;
79
		private JNCSFile file = null;
80
		private String errorMessage = null;
81
		private boolean multifile = false;
82
		private Extent v = null;
83

  
84

  
85
		// Ultimo porcentaje de refresco. Se carga en el update y se
86
		// actualiza en el refreshUpdate
87
		private int lastRefreshPercent = 0;
88

  
89
		public EcwFile(IProjection proj, String fName) {
90
				super(proj, null);
91
				fName = DataSourceSE.normalize(fName);
92
				super.setName(fName);
93
				extent = new Extent();
94

  
95
				try {
96

  
97
					if (!new File(fName).exists() && !fName.startsWith("ecwp:")){
98
						System.err.println("No se puede abrir el archivo");
99
						return;
100
					}
101

  
102
						file = new JNCSFile(fName, false);
103
					load();
104
						//readGeoInfo(fName);
105
						bandCount = file.numBands;
106

  
107
						if ( bandCount > 2) {
108
										setBand(RED_BAND,   0);
109
										setBand(GREEN_BAND, 1);
110
										setBand(BLUE_BAND,  2);
111
						} else
112
										setBand(RED_BAND|GREEN_BAND|BLUE_BAND, 0);
113
				} catch (Exception e) {
114
						errorMessage = e.getMessage();
115
						System.err.println(errorMessage);
116
						e.printStackTrace();
117
				}
118
		}
119

  
120
		/**
121
		 * Carga un ECW.
122
		 *
123
		 * @param fname
124
		 */
125
		public GeoFileSE load() {
126
				double minX;
127
				double minY;
128
				double maxX;
129
				double maxY;
130

  
131
				if(file.cellIncrementY > 0)
132
					file.cellIncrementY = -file.cellIncrementY;
133

  
134
				minX = file.originX;
135
				maxY = file.originY;
136
				maxX = file.originX +
137
							 ((double) (file.width - 1) * file.cellIncrementX);
138
				minY = file.originY +
139
							 ((double) (file.height - 1) * file.cellIncrementY);
140

  
141
				extent = new Extent(minX, minY, maxX, maxY);
142
				requestExtent = extent;
143
				return this;
144
		}
145

  
146
		public void close() {
147
			if(file != null){
148
				file.close(true);
149
				file = null;
150
			}
151
		}
152

  
153
		/**
154
		 * Devuelve el ancho de la imagen
155
		 */
156
		public int getWidth() {
157
				return file.width;
158
		}
159

  
160
		/**
161
		 * Devuelve el alto de la imagen
162
		 */
163
		public int getHeight() {
164
				return file.height;
165
		}
166

  
167
		/**
168
		 *
169
		 */
170
		public void setMultifile(boolean mult) {
171
				this.multifile = mult;
172
		}
173

  
174
		public void setView(Extent e) {
175
			//Aplicamos la transformaci?n a la vista en caso de que haya un fichero .rmf
176
			/*
177
			if(file.cellIncrementY > 0)
178
					file.cellIncrementY = -file.cellIncrementY;
179
			if(minX < file.originX)
180
				minX = file.originX;
181
			if(maxY > file.originY)
182
				maxY = file.originY;
183
			if(maxX > (file.originX + ((double) (file.width - 1) * file.cellIncrementX)))
184
				maxX = file.originX + ((double) (file.width - 1) * file.cellIncrementX);
185
			if(minY < file.originY + ((double) (file.height - 1) * file.cellIncrementY))
186
				minY = file.originY + ((double) (file.height - 1) * file.cellIncrementY);
187

  
188
		Extent transformView = new Extent(	minX, minY, maxX, maxY );*/
189
				v = new Extent(e);
190
		}
191

  
192
		public Extent getView() {
193
				return v;
194
		}
195

  
196
		private void setFileView(int numBands, int [] bandList, ChunkFrame f)
197
			throws JNCSFileNotOpenException, JNCSInvalidSetViewException {
198
				file.setView(file.numBands, bandList, f.v.minX(), f.v.maxY(), f.v.maxX(), f.v.minY(), f.width, f.height);
199
		}
200

  
201
		/**
202
		 * Obtiene un trozo de imagen (determinado por la vista y los par?metros.
203
		 *
204
		 * @param width
205
		 * @param height
206
		 */
207
		public synchronized Image updateImage(int width, int height, ICoordTrans rp) {
208
				// TODO reproyectar para devolver el trozo de imagen pedida sobre ...
209
				// la proyecci?n de destino.
210
				int line = 0;
211
				Dimension fullSize = null;
212
				Image ecwImage = null;
213

  
214
				if (file == null) {
215
						return ecwImage;
216
				}
217

  
218
				try {
219
						int[] bandlist;
220
						int[] bandListTriband;
221
						int[] pRGBArray = null;
222

  
223
						if(mustVerifySize()){
224
						// Work out the correct aspect for the setView call.
225
							double dFileAspect = (double) v.width() / (double) v.height();
226
							double dWindowAspect = (double) width / (double) height;
227

  
228
							if (dFileAspect > dWindowAspect) {
229
									height = (int) ((double) width / dFileAspect);
230
							} else {
231
									width = (int) ((double) height * dFileAspect);
232
							}
233
						}
234
						fullSize = new Dimension(width, height);
235

  
236
						//System.out.println("fullSize = ("+width+","+height+")");
237
						// Peta en los peque?os ... arreglar antes de meter del todo
238
						ChunkFrame[] frames = ChunkFrame.computeFrames(file, v, fullSize, extent);
239

  
240
						if (frames.length == 1) {
241
								width = frames[0].width;
242
								height = frames[0].height;
243

  
244
								if (width <= 0) {
245
										width = 1;
246
								}
247

  
248
								if (height <= 0) {
249
										height = 1;
250
								}
251
						}
252

  
253
						/*                        JNCSDatasetPoint ptMin = file.convertWorldToDataset(v.minX(), v.minY());
254
																		JNCSDatasetPoint ptMax = file.convertWorldToDataset(v.maxX(), v.maxY());
255
																		System.out.println("Dataset coords Width = "+(ptMax.x-ptMin.x)+", px width ="+width);
256
																		// BEGIN Cambiando para soportar e < 1:1
257
																		// TODO Mejorarlo para que los PAN con un zoom muy grande sean correctos
258
																		if ((ptMax.x-ptMin.x)<width) {
259
																						width = ptMax.x-ptMin.x;
260
																						height = ptMin.y-ptMax.y;
261
																						System.out.println("Size=("+width+","+height+")");
262
																						mustResize = true;
263
																		}*/
264

  
265
						// Create an image of the ecw file.
266
						if (doTransparency) {
267
								ecwImage = new BufferedImage(width, height,
268
																						 BufferedImage.TYPE_INT_ARGB);
269
						} else {
270
								ecwImage = new BufferedImage(width, height,
271
																						 BufferedImage.TYPE_INT_RGB);
272
						}
273

  
274
						pRGBArray = new int[width];
275

  
276
						// Setup the view parameters for the ecw file.
277
						bandlist = new int[bandCount];
278
						bandListTriband = new int[bandCount];
279

  
280
						if (bandCount > 2) {
281
								bandlist[0] = getBand(RED_BAND);
282
								bandlist[1] = getBand(GREEN_BAND);
283
								bandlist[2] = getBand(BLUE_BAND);
284

  
285
								if (bandCount > 3) {
286
										for (int i = 3; i < bandCount; i++) {
287
												bandlist[i] = 0;
288
										}
289
								}
290
						} else {
291
								for (int i = 0; i < bandCount; i++) {
292
										bandlist[i] = i;
293
								}
294
						}
295

  
296
						if (bandCount == 3) {
297
								bandListTriband[0] = 0;
298
								bandListTriband[1] = 1;
299
								bandListTriband[2] = 2;
300
						}
301

  
302
						for (int nChunk = 0; nChunk < frames.length; nChunk++) {
303
								ChunkFrame f = frames[nChunk];
304

  
305
								// Set the view
306
								if (bandCount != 3) {
307
										setFileView(file.numBands, bandlist, f);
308
								} else {
309
										setFileView(file.numBands, bandListTriband, f);
310
								}
311

  
312
								/*
313
								 * Esta peli es porque el Ecw no intercambia las bandas con lo que me toca hacerlo
314
								 * a mano. Primero detectamos si se ha alterado el orden de las mismas. Si es as?
315
								 * calculamos mascaras y desplazamientos y hacemos una copia en pRGBArrayCopy
316
								 * con las bandas alteradas de orden
317
								 */
318
								int[] pRGBArrayCopy = null;
319
								int[] mascara = new int[3];
320
								int[] shl = new int[3];
321
								int[] shr = new int[3];
322
								boolean order = true;
323

  
324
								if (bandCount == 3) {
325
										for (int i = 0; i < bandCount; i++)
326
												if (bandlist[i] != i) {
327
														order = false;
328
												}
329

  
330
										if (!order) {
331
												for (int i = 0; i < bandCount; i++) {
332
														switch (bandlist[i]) {
333
														case 0:
334
																mascara[i] = 0x00ff0000;
335
																break;
336
														case 1:
337
																mascara[i] = 0x0000ff00;
338
																break;
339
														case 2:
340
																mascara[i] = 0x000000ff;
341
																break;
342
														}
343
														if ((i == 1) && (bandlist[i] == 0))
344
																shr[i] = 8;
345
														if ((i == 2) && (bandlist[i] == 0))
346
																shr[i] = 16;
347
														if ((i == 0) && (bandlist[i] == 1))
348
																shl[i] = 8;
349
														if ((i == 2) && (bandlist[i] == 1))
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff