Revision 29482

View differences:

tags/tmp_build/extensions/extGeoreferencing/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
4
	<classpathentry kind="var" path="JUNIT_HOME/junit.jar"/>
5
	<classpathentry kind="src" path="/libFMap"/>
6
	<classpathentry kind="src" path="/appgvSIG"/>
7
	<classpathentry kind="lib" path="lib/jama.jar"/>
8
	<classpathentry combineaccessrules="false" kind="src" path="/_fwAndami"/>
9
	<classpathentry combineaccessrules="false" kind="src" path="/libDriverManager"/>
10
	<classpathentry kind="src" path="src-test"/>
11
	<classpathentry kind="src" path="src"/>
12
	<classpathentry sourcepath="/extRasterTools-SE" kind="lib" path="/libFMap/lib/org.gvsig.fmap.raster.jar"/>
13
	<classpathentry sourcepath="/extRasterTools-SE/src" kind="lib" path="/libFMap/lib/org.gvsig.raster.gui.jar"/>
14
	<classpathentry sourcepath="/libUIComponent/src" kind="lib" path="/_fwAndami/lib/org.gvsig.ui.jar"/>
15
	<classpathentry combineaccessrules="false" kind="src" path="/libRaster"/>
16
	<classpathentry sourcepath="/libIverUtiles/src" kind="lib" path="/_fwAndami/lib/iver-utiles.jar"/>
17
	<classpathentry kind="lib" path="/libFMap/lib/org.cresques.cts.jar"/>
18
	<classpathentry sourcepath="/libExceptions/src" kind="lib" path="/_fwAndami/lib/org.gvsig.exceptions.jar"/>
19
	<classpathentry sourcepath="/libGDBMS" kind="lib" path="/libFMap/lib/gdbms-0.8-SNAPSHOT.jar"/>
20
	<classpathentry kind="lib" path="lib/flanagan.jar"/>
21
	<classpathentry kind="output" path="bin"/>
22
</classpath>
tags/tmp_build/extensions/extGeoreferencing/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>extGeoreferencing</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
		<buildCommand>
14
			<name>de.loskutov.FileSync.FSBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
	</buildSpec>
19
	<natures>
20
		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
21
		<nature>org.eclipse.jdt.core.javanature</nature>
22
		<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
23
	</natures>
24
</projectDescription>
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/process/TGeoTransformProcessMapToPixelXTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
41
package org.gvsig.georeferencing.process;
42

  
43
import java.awt.geom.Point2D;
44

  
45
import junit.framework.TestCase;
46

  
47
import org.gvsig.georeferencing.process.geotransform.GeoTransformDataResult;
48
import org.gvsig.georeferencing.process.geotransform.GeoTransformProcess;
49
import org.gvsig.raster.datastruct.GeoPoint;
50

  
51
import Jama.Matrix;
52

  
53
/**Test que prueba la el proceso de geotransfornmcion dados una serie de puntos de
54
 * control.  Compara los coeficientes obtenidos para el polinomio de transformacion  
55
 * (de coordenadas mapa a coordenadas pixel para las X), con los obtenidos 
56
 * manualmente, resolviendo por el m?todo de Cramer.
57
 * 
58
 * 
59
 * @author aMu?oz (alejandro.munoz@uclm.es)
60
 * */
61

  
62
public class TGeoTransformProcessMapToPixelXTest extends TestCase {
63

  
64
	private GeoPoint gpcs[] = new GeoPoint[3];
65
	private double geoPoints[][] ={{ 1369.000000  	,	2985.750000	},
66
								   { 1673.500000  	,   2803.250000	},
67
								   { 2092.500000 	,   2933.250000	},
68
							       }; 
69
								   
70
	private double imagePoints[][]={{ 577.500000     ,	2427.500000 },
71
									{ 803.000000     ,  2235.500000 },
72
									{ 1165.500000    ,  2285.250000	},
73
									};
74
	public void start() {
75
		this.testStack();
76
	}
77
	
78
	
79
	public void testStack() {
80
		System.err.println("TGeoTransformProcessMapToPixelXTest running...");
81
		
82
		for(int i=0;i<geoPoints.length;i++)
83
		{
84
			Point2D  pW = new Point2D.Double(geoPoints[i][0],geoPoints[i][1]);
85
			Point2D  pP = new Point2D.Double(imagePoints[i][0],imagePoints[i][1]);
86
			gpcs[i]= new GeoPoint(pP,pW);
87
		}
88
		
89
		GeoTransformProcess proceso = new GeoTransformProcess();
90
		proceso.addParam("gpcs",gpcs);
91
		proceso.addParam("orden", new Integer(1));
92
		proceso.run();
93
		
94
		GeoTransformDataResult resultado= (GeoTransformDataResult) proceso.getResult();
95
		
96
		// Estimacion de los coeficientes de forma manual, siquiento la teoria del manual de Jose Gonzalez
97
		 
98
		// Matriz para el ejmplo correspondiente a la figura 2.20
99
		double M[][]={
100
					{3,			5135,			8722.25},
101
					{5135,		9053319.5,		14916556.225},
102
					{8722.25,	14916556.225,	25376869.1875}
103
					};
104
		Matrix m_M = new Matrix(M);
105
		double det= m_M.det();
106
		
107
		
108
		double A0[][]={
109
					{2546.0,			5135,			8722.25},
110
					{4573226.75,	9053319.5,		14916556.225},
111
					{7393983.25,	14916556.225,	25376869.1875}
112
		};
113
		Matrix m_A0= new Matrix (A0);
114
		double coef0= m_A0.det()/det;
115
		
116
		
117
		
118
		double A1[][]={
119
				{3,			2546.0,		  8722.25},
120
				{5135,		4573226.75,	  14916556.225},
121
				{8722.25,	7393983.25,	  25376869.1875}
122
		};
123
		Matrix m_A1= new Matrix (A1);
124
		double coef1= m_A1.det()/det;
125
		
126
		double A2[][]={
127
					{3,			5135,			2546.0},
128
					{5135,		9053319.5,		4573226.75},
129
					{8722.25,	14916556.225,	7393983.25}
130
				};
131
			
132
		Matrix m_A2= new Matrix (A2);
133
		double coef2= m_A2.det()/det;
134
		
135
		// Comprobacion de los coeficientes obtenidos tras el proceso con los determinados de forma manual
136
		
137
		assertEquals(coef0, resultado.getMapToPixelCoefX()[0],0.1);
138
		assertEquals(coef1, resultado.getMapToPixelCoefX()[1],0.1);
139
		assertEquals(coef2, resultado.getMapToPixelCoefX()[2],0.1);
140
		
141
	}
142
}
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/process/TGeoTransformProcessPixelToMapXTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
41
package org.gvsig.georeferencing.process;
42

  
43
import java.awt.geom.Point2D;
44

  
45
import junit.framework.TestCase;
46

  
47
import org.gvsig.georeferencing.process.geotransform.GeoTransformDataResult;
48
import org.gvsig.georeferencing.process.geotransform.GeoTransformProcess;
49
import org.gvsig.raster.datastruct.GeoPoint;
50

  
51
import Jama.Matrix;
52

  
53
/**Test que prueba la el proceso de geotransfornmcion dados una serie de puntos de
54
 * control.  Compara los coeficientes obtenidos para el polinomio de transformacion  
55
 * (de coordenadas pixel a coordenadas mapa para las X), con los obtenidos 
56
 * manualmente, resolviendo por el m?todo de Cramer.
57
 * 
58
 * 
59
 * @author aMu?oz (alejandro.munoz@uclm.es)
60
 * */
61

  
62
public class TGeoTransformProcessPixelToMapXTest extends TestCase {
63

  
64
	private GeoPoint gpcs[] = new GeoPoint[3];
65
	private double geoPoints[][] ={{ 1369.000000  	,	2985.750000	},
66
								   { 1673.500000  	,   2803.250000	},
67
								   { 2092.500000 	,   2933.250000	},
68
							       }; 
69
								   
70
	private double imagePoints[][]={{ 577.500000     ,	2427.500000 },
71
									{ 803.000000     ,  2235.500000 },
72
									{ 1165.500000    ,  2285.250000	},
73
									};
74
	public void start() {
75
		this.testStack();
76
	}
77
	
78
	
79
	public void testStack() {
80
		System.err.println("TGeoTransformProcessPixelToMapXTest running...");
81
		
82
		for(int i=0;i<geoPoints.length;i++)
83
		{
84
			Point2D  pW = new Point2D.Double(geoPoints[i][0],geoPoints[i][1]);
85
			Point2D  pP = new Point2D.Double(imagePoints[i][0],imagePoints[i][1]);
86
			gpcs[i]= new GeoPoint(pP,pW);
87
		}
88
		
89
		GeoTransformProcess proceso = new GeoTransformProcess();
90
		proceso.addParam("gpcs",gpcs);
91
		proceso.addParam("orden", new Integer(1));
92
		proceso.run();
93
		
94
		GeoTransformDataResult resultado= (GeoTransformDataResult) proceso.getResult();
95
		
96
		// Estimacion de los coeficientes de forma manual, siquiento la teoria del manual de Jose Gonzalez
97
		 
98
		// Matriz para el ejmplo correspondiente a la figura 2.20
99
		double M[][]={
100
				{3,			2546,			6948.25},
101
				{2546,		2336705.5,		5860446.625},
102
				{6948.25,	5860446.625,	16112584.0625}
103
					};
104
		Matrix m_M = new Matrix(M);
105
		double det= m_M.det();
106
		
107
		
108
		double A0[][]={
109
				{5135,				2546,			6948.25},
110
				{4573226.75,		2336705.5,		5860446.625},
111
				{11846242.375,	    5860446.625,	16112584.0625}
112
		};
113
		Matrix m_A0= new Matrix (A0);
114
		double coef0= m_A0.det()/det;
115
		
116
		
117
		
118
		double A1[][]={
119
				{3,			5135,			6948.25},
120
				{2546,		4573226.75,		5860446.625},
121
				{6948.25,	11846242.375,	16112584.0625}
122
		};
123
		Matrix m_A1= new Matrix (A1);
124
		double coef1= m_A1.det()/det;
125
		
126
		double A2[][]={
127
				{3,			2546,			5135},
128
				{2546,		2336705.5,		4573226.75},
129
				{6948.25,	5860446.625,	   11846242.375}
130
				};
131
			
132
		Matrix m_A2= new Matrix (A2);
133
		double coef2= m_A2.det()/det;
134
		
135
		// Comprobacion de los coeficientes obtenidos tras el proceso con los determinados de forma manual
136
		
137
		assertEquals(coef0, resultado.getPixelToMapCoefX()[0],0.1);
138
		assertEquals(coef1, resultado.getPixelToMapCoefX()[1],0.1);
139
		assertEquals(coef2, resultado.getPixelToMapCoefX()[2],0.1);
140
		
141
	}
142
}
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/process/TGeoTransformProcessMapToPixelYTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
41
package org.gvsig.georeferencing.process;
42

  
43
import java.awt.geom.Point2D;
44

  
45
import junit.framework.TestCase;
46

  
47
import org.gvsig.georeferencing.process.geotransform.GeoTransformDataResult;
48
import org.gvsig.georeferencing.process.geotransform.GeoTransformProcess;
49
import org.gvsig.raster.datastruct.GeoPoint;
50

  
51
import Jama.Matrix;
52

  
53
/**Test que prueba la el proceso de geotransfornmcion dados una serie de puntos de
54
 * control.  Compara los coeficientes obtenidos para el polinomio de transformacion  
55
 * (de coordenadas mapa a coordenadas pixel para las Y), con los obtenidos 
56
 * manualmente, resolviendo por el m?todo de Cramer.
57
 * 
58
 * 
59
 * @author aMu?oz (alejandro.munoz@uclm.es)
60
 * */
61

  
62
public class TGeoTransformProcessMapToPixelYTest extends TestCase {
63

  
64
	private GeoPoint gpcs[] = new GeoPoint[3];
65
	private double geoPoints[][] ={{ 1369.000000  	,	2985.750000	},
66
								   { 1673.500000  	,   2803.250000	},
67
								   { 2092.500000 	,   2933.250000	},
68
							       }; 
69
								   
70
	private double imagePoints[][]={{ 577.500000     ,	2427.500000 },
71
									{ 803.000000     ,  2235.500000 },
72
									{ 1165.500000    ,  2285.250000	},
73
									};
74
	public void start() {
75
		this.testStack();
76
	}
77
	
78
	
79
	public void testStack() {
80
		System.err.println("TGeoTransformProcessMapToPixelYTest running...");
81
		
82
		for(int i=0;i<geoPoints.length;i++)
83
		{
84
			Point2D  pW = new Point2D.Double(geoPoints[i][0],geoPoints[i][1]);
85
			Point2D  pP = new Point2D.Double(imagePoints[i][0],imagePoints[i][1]);
86
			gpcs[i]= new GeoPoint(pP,pW);
87
		}
88
		
89
		GeoTransformProcess proceso = new GeoTransformProcess();
90
		proceso.addParam("gpcs",gpcs);
91
		proceso.addParam("orden", new Integer(1));
92
		proceso.run();
93
		
94
		GeoTransformDataResult resultado= (GeoTransformDataResult) proceso.getResult();
95
		
96
		// Estimacion de los coeficientes de forma manual, siquiento la teoria del manual de Jose Gonzalez
97
		 
98
		// Matriz para el ejmplo correspondiente a la figura 2.20
99
		double M[][]={
100
					{3,			5135,			8722.25},
101
					{5135,		9053319.5,		14916556.225},
102
					{8722.25,	14916556.225,	25376869.1875}
103
					};
104
		Matrix m_M = new Matrix(M);
105
		double det= m_M.det();
106
		
107
		
108
		double A0[][]={
109
					{6948.25,			5135,			8722.25},
110
					{11846242.375,	9053319.5,		14916556.225},
111
					{20217783.0625,	14916556.225,	25376869.1875}
112
		};
113
		Matrix m_A0= new Matrix (A0);
114
		double coef0= m_A0.det()/det;
115
		
116
		
117
		
118
		double A1[][]={
119
				{3,			6948.25,		  8722.25},
120
				{5135,		11846242.375,	  14916556.225},
121
				{8722.25,	20217783.0625,	  25376869.1875}
122
		};
123
		Matrix m_A1= new Matrix (A1);
124
		double coef1= m_A1.det()/det;
125
		
126
		double A2[][]={
127
					{3,			5135,			6948.25},
128
					{5135,		9053319.5,		11846242.375},
129
					{8722.25,	14916556.225,	20217783.0625}
130
				};
131
			
132
		Matrix m_A2= new Matrix (A2);
133
		double coef2= m_A2.det()/det;
134
		
135
		// Comprobacion de los coeficientes obtenidos tras el proceso con los determinados de forma manual
136
		
137
		assertEquals(coef0, resultado.getMapToPixelCoefY()[0],0.1);
138
		assertEquals(coef1, resultado.getMapToPixelCoefY()[1],0.1);
139
		assertEquals(coef2, resultado.getMapToPixelCoefY()[2],0.1);
140
		
141
	}
142
}
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/process/TGeoTransformProcessPixelToMapYTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
41
package org.gvsig.georeferencing.process;
42

  
43
import java.awt.geom.Point2D;
44

  
45
import junit.framework.TestCase;
46

  
47
import org.gvsig.georeferencing.process.geotransform.GeoTransformDataResult;
48
import org.gvsig.georeferencing.process.geotransform.GeoTransformProcess;
49
import org.gvsig.raster.datastruct.GeoPoint;
50

  
51
import Jama.Matrix;
52

  
53
/**Test que prueba la el proceso de geotransfornmcion dados una serie de puntos de
54
 * control.  Compara los coeficientes obtenidos para el polinomio de transformacion  
55
 * (de coordenadas pixel a coordenadas mapa para las Y), con los obtenidos 
56
 * manualmente, resolviendo por el m?todo de Cramer.
57
 * 
58
 * 
59
 * @author aMu?oz (alejandro.munoz@uclm.es)
60
 * */
61

  
62
public class TGeoTransformProcessPixelToMapYTest extends TestCase {
63

  
64
	private GeoPoint gpcs[] = new GeoPoint[3];
65
	private double geoPoints[][] ={{ 1369.000000  	,	2985.750000	},
66
								   { 1673.500000  	,   2803.250000	},
67
								   { 2092.500000 	,   2933.250000	},
68
							       }; 
69
								   
70
	private double imagePoints[][]={{ 577.500000     ,	2427.500000 },
71
									{ 803.000000     ,  2235.500000 },
72
									{ 1165.500000    ,  2285.250000	},
73
									};
74
	public void start() {
75
		this.testStack();
76
	}
77
	
78
	
79
	public void testStack() {
80
		System.err.println("TGeoTransformProcessPixelToMapYTest running...");
81
		
82
		for(int i=0;i<geoPoints.length;i++)
83
		{
84
			Point2D  pW = new Point2D.Double(geoPoints[i][0],geoPoints[i][1]);
85
			Point2D  pP = new Point2D.Double(imagePoints[i][0],imagePoints[i][1]);
86
			gpcs[i]= new GeoPoint(pP,pW);
87
		}
88
		
89
		GeoTransformProcess proceso = new GeoTransformProcess();
90
		proceso.addParam("gpcs",gpcs);
91
		proceso.addParam("orden", new Integer(1));
92
		proceso.run();
93
		
94
		GeoTransformDataResult resultado= (GeoTransformDataResult) proceso.getResult();
95
		
96
		// Estimacion de los coeficientes de forma manual, siquiento la teoria del manual de Jose Gonzalez
97
		// Matriz para el ejmplo correspondiente a la figura 2.20 del documento.
98
		double M[][]={
99
					{3,			2546,			6948.25},
100
					{2546,		2336705.5,		5860446.625},
101
					{6948.25,	5860446.625,	16112584.0625}
102
					};
103
		Matrix m_M = new Matrix(M);
104
		double det= m_M.det();
105
		
106
		
107
		double A0[][]={
108
				{8722.25,			2546,			6948.25},
109
				{7393983.25,		2336705.5,		5860446.625},
110
				{20217783.062,		5860446.625,	16112584.0625}
111
		};
112
		Matrix m_A0= new Matrix (A0);
113
		double coef0= m_A0.det()/det;
114
		
115
		
116
		
117
		double A1[][]={
118
				{3,			8722.25,		  6948.25},
119
				{2546,		7393983.25,	  	  5860446.625},
120
				{6948.25,	20217783.062,	  16112584.0625}
121
		};
122
		Matrix m_A1= new Matrix (A1);
123
		double coef1= m_A1.det()/det;
124
		
125
		double A2[][]={
126
				{3,			2546,			8722.25,		  },
127
				{2546,		2336705.5,		7393983.25,	  	  },
128
				{6948.25,	5860446.625,	20217783.062,	  }
129
				};
130
			
131
		Matrix m_A2= new Matrix (A2);
132
		double coef2= m_A2.det()/det;
133
		
134
		// Comprobacion de los coeficientes obtenidos tras el proceso con los determinados de forma manual
135
		
136
		assertEquals(coef0, resultado.getPixelToMapCoefY()[0],0.1);
137
		assertEquals(coef1, resultado.getPixelToMapCoefY()[1],0.1);
138
		assertEquals(coef2, resultado.getPixelToMapCoefY()[2],0.1);
139
		
140
	}
141
}
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/process/TestGeoTransformProcess.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
	 *
3
	 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
	 *
5
	 * This program is free software; you can redistribute it and/or
6
	 * modify it under the terms of the GNU General Public License
7
	 * as published by the Free Software Foundation; either version 2
8
	 * of the License, or (at your option) any later version.
9
	 *
10
	 * This program is distributed in the hope that it will be useful,
11
	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
	 * GNU General Public License for more details.
14
	 *
15
	 * You should have received a copy of the GNU General Public License
16
	 * along with this program; if not, write to the Free Software
17
	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
	 *
19
	 * For more information, contact:
20
	 *
21
	 *  Generalitat Valenciana
22
	 *   Conselleria d'Infraestructures i Transport
23
	 *   Av. Blasco Iba?ez, 50
24
	 *   46010 VALENCIA
25
	 *   SPAIN
26
	 *
27
	 *      +34 963862235
28
	 *   gvsig@gva.es
29
	 *      www.gvsig.gva.es
30
	 *
31
	 *    or
32
	 *
33
	 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
	 *   Campus Universitario s/n
35
	 *   02071 Alabacete
36
	 *   Spain
37
	 *
38
	 *   +34 967 599 200
39
	 */
40

  
41
package org.gvsig.georeferencing.process;
42

  
43
import java.awt.geom.Point2D;
44

  
45
import org.gvsig.georeferencing.process.geotransform.GeoTransformDataResult;
46
import org.gvsig.georeferencing.process.geotransform.GeoTransformProcess;
47
import org.gvsig.raster.datastruct.GeoPoint;
48

  
49
import Jama.Matrix;
50

  
51
import junit.framework.TestCase;
52

  
53
/**
54
 *  Test para el proceso de transformacion.
55
 *  
56
 *  El test prueba transformacion de orden dos calculados a partir de una lista de diez puntos.
57
 *  Los resultados de la transformacion son comparados con los calculos realizados de forma manual.
58
 *  Se compara la evaluacion de los polinomios para los cuatro primeros puntos de la lista tanto para 
59
 *  la funcion directa como la inversa. Se compara el rms obtenido en cada punto.
60
 *   
61
 *  @author Alejandro Mu?oz Sanchez
62
 * 
63
 * */
64

  
65
public class TestGeoTransformProcess  extends TestCase{
66

  
67
	private GeoPoint gpcs[] = new GeoPoint[10];
68
	private GeoTransformDataResult transformData;
69
	
70
	private double geoPoints[][] ={	{ 1369.000000  	,	2985.750000	},
71
									{ 1673.500000  	,   2803.250000	},
72
									{ 2092.500000 	,   2933.250000	},
73
									{ 2354.000000  	,   3211.000000	},
74
									{ 2731.500000    ,  3193.500000	},
75
									{ 3054.500000    ,  3079.500000	},
76
									{ 3009.250000    , 	3380.500000	},
77
									{ 3057.250000    ,  3552.750000	},
78
									{ 2944.750000    ,  3584.750000	},
79
									{ 2892.500000    ,  3444.000000	},}; 
80

  
81
								   
82
	private double imagePoints[][]={{ 577.500000     ,	2427.500000 },
83
									{ 803.000000     ,  2235.500000 },
84
									{ 1165.500000    ,  2285.250000	},
85
									{ 1419.250000    ,  2478.750000 },
86
									{ 1727.000000    ,  2412.250000 },
87
									{ 1977.500000    ,  2274.250000	},
88
									{ 1981.500000    ,  2528.250000	},
89
									{ 2044.000000    ,  2663.750000 },
90
									{ 1955.750000    ,  2705.500000 }, 
91
									{ 1893.500000    , 	2596.250000},};
92
	
93
	public void start() {
94
		this.setUp();
95
		this.testStack();
96
	}
97
	
98
	
99
	public void setUp(){
100
	}
101
	
102
	public void testStack(){
103
		for(int i=0;i<geoPoints.length;i++)
104
			{
105
				Point2D  pW = new Point2D.Double(geoPoints[i][0],geoPoints[i][1]);
106
				Point2D  pP = new Point2D.Double(imagePoints[i][0],imagePoints[i][1]);
107
				gpcs[i]= new GeoPoint(pP,pW);
108
			}
109
	
110
		GeoTransformProcess order2Transform = new GeoTransformProcess();
111
		order2Transform.addParam("gpcs",gpcs );
112
		order2Transform.addParam("orden",new Integer(2));
113
		order2Transform.run();	
114
		transformData= (GeoTransformDataResult)order2Transform.getResult();
115

  
116
		
117
// 		Resolucion del sistema  calculado manualmente
118
		double data[][]={
119
				{10,			15544.5,			24607.25,		 26758589.88,			38703411.06	,			60795805.19	  	},		
120
				{15544.5,		26758589.88,		38703411.06,	 48625448159.44,		67148886519.52,			96748134874.2 	},
121
				{24607.25,		38703411.06,		6.07958051875E7, 67148886519.52,		96748134874.2,			150805605253.3	},
122
				{26758589.88,	48625448159.44,		67148886519.52,	 90973349316414.1,		1.22623111101991E014,	1.69145826718794E014},
123
				{38703411.06,	67148886519.52,		96748134874.2,	 1.22623111101991E014,	1.69145826718794E014,	2.42781993510560E014},
124
				{60795805.19,	96748134874.2, 		150805605253.3,	 1.69145826718794E014,	2.42781993510560E014,	3.7555377732236494E14}	
125
		};
126
		double[][] result={{25178.75},{42119706.94}, {62445537.63}, {75433589688.61}, {105416642600.75}, {155494570974.03} };
127
		double[][] result2={{32168.25},{5.10484513125E07}, {7.9534535625E07}, {8.899835767423438E10}, {1.276577668393125E11}, {1.9743243258296875E11} };
128
		
129
		
130
//		 Resolucion del sistema  calculado manualmente
131
		double data2[][]={
132
				{10,				25178.75,				32168.25,		 		 6.68261699375E7,			8.2157005375E7	,			1.041305340625E8 },		
133
				{25178.75,			6.68261699375E7,		8.2157005375E7,	 		 1.8389906361945312E11,		2.2036071049725E11,			2.69580937964375E11 },
134
				{32168.25,			8.2157005375E7,			1.041305340625E8, 		 2.2036071049725E11,		2.69580937964375E11,		3.391527268821094E11},
135
				{6.68261699375E7,	1.8389906361945312E11,	2.2036071049725E11,	 	 5.185110007030175E14,		6.109291412182252E14,		7.302233191555645E14},
136
				{8.2157005375E7,	2.2036071049725E11,		2.69580937964375E11,	 6.109291412182252E14,		7.302233191555645E14,		8.893696706241302E14},
137
				{1.041305340625E8,	2.69580937964375E11, 	3.391527268821094E11,	 7.302233191555645E14,		8.893696706241302E14,		1.1112299175456508E15}	
138
		};
139
		
140
		double[][] result3={{24607.25},{6.2445537625E7}, {7.9534535625E7}, {1.6674342953621875E11}, {2.0468178349823438E11}, {2.5867104246403125E11} };
141
		double[][] result4={{15544.5},{4.21197069375E7}, {5.10484513125E7}, {1.1748417342507812E11}, {1.3954105605085938E11}, {1.6852035242098438E11} };
142
		
143
		
144
		Matrix matrix= new Matrix(data);
145
		Matrix matrix2= new Matrix(data2);
146
		
147
		Matrix coef=matrix.solve(new Matrix(result)); 
148
		Matrix coef2= matrix.solve(new Matrix(result2));
149
		Matrix coef3= matrix2.solve(new Matrix(result3));
150
		Matrix coef4= matrix2.solve(new Matrix(result4));
151
		
152
		// Comparacion de los coeficientes con los calculados manualmente
153
		for(int i=0; i<transformData.getPixelToMapCoefX().length; i++){
154
			assertEquals(coef.get(i,0),transformData.getPixelToMapCoefX()[i],0.2);
155
			assertEquals(coef2.get(i,0),transformData.getPixelToMapCoefY()[i],0.2);
156
			assertEquals(coef3.get(i,0),transformData.getMapToPixelCoefY()[i],0.2);
157
			assertEquals(coef4.get(i,0),transformData.getMapToPixelCoefX()[i],0.2);
158
		}
159
		
160
		// Evaluacion del polinomio en los cuatro primeros puntos de la lista
161
		double evaluate[][]= {{577.49,2427.49},{803 , 2235.5},{1165.49,2285.25},{1419.25,2478.75}};
162
		for(int i=0; i<4; i++)
163
		{
164
			evaluate[i]=transformData.getCoordPixel(gpcs[i].mapPoint.getX(),gpcs[i].mapPoint.getY());
165
			assertEquals(evaluate[i][0],gpcs[i].getEvaluateX(),0.3);
166
			assertEquals(evaluate[i][1],gpcs[i].getEvaluateY(),0.3);
167
		
168
		}
169
		
170
		double  rms []= {2.5846147599746093E-4,	1.4315791732756158E-4, 1.4937615015849659E-4,4.836399323913263E-4};
171
		for(int i=0; i<4; i++)
172
			assertEquals(gpcs[i].getRms(),rms[i],0.1);
173
		
174
	}	
175
}
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/process/TGeotransformProcessRMS.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
41
package org.gvsig.georeferencing.process;
42

  
43
import java.awt.geom.Point2D;
44

  
45
import junit.framework.TestCase;
46

  
47
import org.gvsig.georeferencing.process.geotransform.GeoTransformDataResult;
48
import org.gvsig.georeferencing.process.geotransform.GeoTransformProcess;
49
import org.gvsig.raster.datastruct.GeoPoint;
50
import org.gvsig.raster.datastruct.GeoPointList;
51

  
52
/**
53
 * Test que prueba la el proceso de geotransfornmcion dados una serie de puntos de
54
 * control.  Compara las coordenadas aproximadas tras el calculo de los polinomios de transformaci?n.
55
 * El punto en coordenadas mapa que se evalua es (1500,2500). Se comprueban los errores obtenidos tras el proceso 
56
 * con los calculados manualmente.
57
 * 
58
 * @author aMu?oz (alejandro.munoz@uclm.es)
59
 * */
60

  
61
public class TGeotransformProcessRMS extends TestCase {
62

  
63
	private GeoPoint gpcs[] = new GeoPoint[3];
64
	private double geoPoints[][] ={{ 1369.000000  	,	2985.750000	},
65
									 { 1673.500000  	,   2803.250000	},
66
									 { 2092.500000 	,   2933.250000	},
67
										 }; 
68
									 
69
	private double imagePoints[][]={{ 577.500000     ,	2427.500000 },
70
									{ 803.000000     ,  2235.500000 },
71
									{ 1165.500000    ,  2285.250000	},
72
									};
73
	public void start() {
74
		this.testStack();
75
	}
76
	
77
	
78
	public void testStack() {
79
		System.err.println("TGeotransformProcessRMS running...");
80
		
81
		for(int i=0;i<geoPoints.length;i++)
82
		{
83
			Point2D  pW = new Point2D.Double(geoPoints[i][0],geoPoints[i][1]);
84
			Point2D  pP = new Point2D.Double(imagePoints[i][0],imagePoints[i][1]);
85
			gpcs[i]= new GeoPoint(pP,pW);
86
		}
87
		
88
		GeoTransformProcess proceso = new GeoTransformProcess();
89
		proceso.addParam("gpcs",gpcs);
90
		proceso.addParam("orden", new Integer(1));
91
		proceso.run();
92
		
93
		GeoTransformDataResult resultado= (GeoTransformDataResult) proceso.getResult();
94
		double coordPixel[]= resultado.getCoordPixel(1500,2500);
95
		
96
		// Aproximacion manual conocidos los coeficientes
97
		double x_value= -957.700+0.822655*1500+0.1369789*2500;
98
		double y_value= 155.357-0.13683*1500+0.82373*2500;
99
		assertEquals(coordPixel[0],x_value, 0.1);
100
		assertEquals(coordPixel[1],y_value, 0.1);
101
		
102
		
103
		// Se evaluan los RMS de los tres puntos de partida y se comparan con los obtenidos 
104
		// tras la transformaci?m.
105
		double x_1= -957.700+0.822655*1369+0.1369789*2985.75;
106
		double x_2= -957.700+0.822655*1673.5+0.1369789*2803.25;
107
		double x_3= -957.700+0.822655*2092.5+0.1369789*2933.25;
108
		
109
		double y_1= 155.357-0.13683*1369+0.82373*2985.75;
110
		double y_2= 155.357-0.13683*1673.5+0.82373*2803.25;
111
		double y_3= 155.357-0.13683*2092.5+0.82373*2933.25;
112
		
113
		assertEquals(x_1,resultado.getCoordPixel(1369.000000 ,2985.750000)[0],0.1);
114
		assertEquals(y_1,resultado.getCoordPixel(1369.000000 ,2985.750000)[1],0.1);
115
		
116
		assertEquals(x_2,resultado.getCoordPixel(1673.500000, 2803.250000)[0],0.1);
117
		assertEquals(y_2,resultado.getCoordPixel(1673.500000, 2803.250000)[1],0.1);
118
		
119
		assertEquals(x_3,resultado.getCoordPixel(2092.500000 , 2933.250000)[0],0.1);
120
		assertEquals(y_3,resultado.getCoordPixel(2092.500000 , 2933.250000)[1],0.1);
121
		
122
	
123
		GeoPointList list = resultado.getGpcs();
124

  
125
		// Comparativa del error en x
126
		assertEquals(Math.pow(x_1 - gpcs[0].pixelPoint.getX(), 2), list.get(0).getErrorX(), 0.001);
127
		assertEquals(Math.pow(x_2 - gpcs[1].pixelPoint.getX(), 2), list.get(1).getErrorX(), 0.001);
128
		assertEquals(Math.pow(x_3 - gpcs[2].pixelPoint.getX(), 2), list.get(2).getErrorX(), 0.001);
129

  
130
		// Comparativa del error en y
131
		assertEquals(Math.pow(y_1 - gpcs[0].pixelPoint.getY(), 2), list.get(0).getErrorY(), 0.001);
132
		assertEquals(Math.pow(y_2 - gpcs[1].pixelPoint.getY(), 2), list.get(1).getErrorY(), 0.001);
133
		assertEquals(Math.pow(y_3 - gpcs[2].pixelPoint.getY(), 2), list.get(2).getErrorY(), 0.001);	
134
				
135
		double rms1=Math.sqrt( Math.pow(x_1 - gpcs[0].pixelPoint.getX(), 2)+ Math.pow(y_1 - gpcs[0].pixelPoint.getY(), 2));
136
		double rms2=Math.sqrt( Math.pow(x_2 - gpcs[1].pixelPoint.getX(), 2)+ Math.pow(y_2 - gpcs[1].pixelPoint.getY(), 2));
137
		double rms3=Math.sqrt( Math.pow(x_3 - gpcs[2].pixelPoint.getX(), 2)+ Math.pow(y_3 - gpcs[2].pixelPoint.getY(), 2));
138
		
139
		assertEquals((rms1+rms2+rms3)/3, resultado.getRmsTotal(),0.01);
140
		
141
		
142
	}
143
}
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/process/AllGeoTransformTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
34
 *   Campus Universitario s/n
35
 *   02071 Alabacete
36
 *   Spain
37
 *
38
 *   +34 967 599 200
39
 */
40

  
41
package org.gvsig.georeferencing.process;
42

  
43
import junit.framework.Test;
44
import junit.framework.TestCase;
45
import junit.framework.TestSuite;
46

  
47
public class AllGeoTransformTest extends TestCase {
48
	
49
	public static Test suite() {
50
		TestSuite suite = new TestSuite("Test GeoTransformProcess");
51
		//$JUnit-BEGIN$
52
		
53
		suite.addTestSuite(TestGeoTransformProcess.class);
54
		suite.addTestSuite(TGeoTransformProcessPixelToMapXTest.class);
55
		suite.addTestSuite(TGeoTransformProcessPixelToMapYTest.class);
56
		suite.addTestSuite(TGeoTransformProcessMapToPixelXTest.class);
57
		suite.addTestSuite(TGeoTransformProcessMapToPixelYTest.class);
58
		suite.addTestSuite(TGeotransformProcessRMS.class);
59
		//$JUnit-END$
60
		return suite;
61
	}
62

  
63
}
64

  
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/TestGeorefOptionsDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.georeferencing;
20

  
21
import javax.swing.JFrame;
22
import javax.swing.UIManager;
23

  
24
import org.gvsig.georeferencing.ui.options.GeorefOptionsPanel;
25
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
26
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
27
/**
28
 * Test para el panel de geolocalizaci?n
29
 *
30
 * @version 30/07/2007
31
 * @author Nacho Brodin (nachobrodin@gmail.com)
32
 */
33
public class TestGeorefOptionsDialog implements ButtonsPanelListener {
34
	private JFrame 			frame = new JFrame();
35

  
36
	public TestGeorefOptionsDialog() {
37
		super();
38
		initialize();
39
	}
40

  
41
	public static void main(String[] args) {
42
		try {
43
			UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
44
		} catch( Exception e ) {
45
			System.err.println( "No se puede cambiar al LookAndFeel");
46
		}
47
		new TestGeorefOptionsDialog();
48
	}
49

  
50
	private void initialize() {
51
		GeorefOptionsPanel glp = new GeorefOptionsPanel(3, this);
52
		frame.setContentPane(glp);
53

  
54
		frame.setSize(new java.awt.Dimension(420, 380));
55
		frame.setResizable(true);
56
		frame.setTitle("Georeferenciaci?n");
57
		frame.setVisible(true);
58
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
59
	}
60

  
61
	public void actionButtonPressed(ButtonsPanelEvent e) {
62
	}
63
}
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/TestGeorefLauncherDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.georeferencing;
20

  
21
import javax.swing.JFrame;
22
import javax.swing.UIManager;
23

  
24
import org.gvsig.georeferencing.ui.launcher.GeorefLauncherPanel;
25
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
26
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
27
/**
28
 * Test para el panel de geolocalizaci?n
29
 *
30
 * @version 30/07/2007
31
 * @author Nacho Brodin (nachobrodin@gmail.com)
32
 */
33
public class TestGeorefLauncherDialog implements ButtonsPanelListener {
34
	private JFrame 			frame = new JFrame();
35

  
36
	public TestGeorefLauncherDialog() {
37
		super();
38
		initialize();
39
	}
40

  
41
	public static void main(String[] args) {
42
		try {
43
			UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
44
		} catch( Exception e ) {
45
			System.err.println( "No se puede cambiar al LookAndFeel");
46
		}
47
		new TestGeorefLauncherDialog();
48
	}
49

  
50
	private void initialize() {
51
		GeorefLauncherPanel glp = new GeorefLauncherPanel(new String[]{"vista1", "vista2"}, 3, this);
52
		frame.setContentPane(glp);
53

  
54
		frame.setSize(new java.awt.Dimension(420, 380));
55
		frame.setResizable(true);
56
		frame.setTitle("Georeferenciaci?n");
57
		frame.setVisible(true);
58
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
59
	}
60

  
61
	public void actionButtonPressed(ButtonsPanelEvent e) {
62
	}
63
}
tags/tmp_build/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/TestViewDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.georeferencing;
20

  
21
import javax.swing.JFrame;
22
import javax.swing.UIManager;
23

  
24
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
25
import org.gvsig.georeferencing.ui.zoom.InvalidRequestException;
26
import org.gvsig.georeferencing.ui.zoom.ViewRasterRequestManager;
27
import org.gvsig.georeferencing.ui.zoom.tools.ToolEvent;
28
import org.gvsig.georeferencing.ui.zoom.tools.ToolListener;
29
import org.gvsig.georeferencing.view.ViewDialog;
30

  
31
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
32
import com.iver.utiles.swing.threads.Cancellable;
33

  
34
/**
35
 * Test para la vista de georreferenciaci?n con peticiones a la capa.
36
 *
37
 * @version 30/07/2007
38
 * @author Nacho Brodin (nachobrodin@gmail.com)
39
 */
40
public class TestViewDialog implements ToolListener {
41
	private JFrame 	   frame = new JFrame();
42
	private String     path = "/home/nacho/images/500k_2.ecw";
43
	//private String     path = "/home/nacho/images/orto5mv30f290126cor03.sid"; 
44
	//private String     path = "/home/nacho/images/wcs16bits.tif";
45
	//private String     path = "/home/nacho/images/03AUG23153350-M2AS-000000122423_01_P001-BROWSE.jpg";
46
	private int        w = 500, h = 500;
47

  
48
	public TestViewDialog() {
49
		super();
50
		initialize();
51
	}
52

  
53
	public static void main(String[] args) {
54
		try {
55
			UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
56
		} catch( Exception e ) {
57
			System.err.println( "No se puede cambiar al LookAndFeel");
58
		}
59
		new TestViewDialog();
60
	}
61

  
62
	private void initialize() {
63
		FLyrRasterSE layer = null;
64
		try {
65
			layer = FLyrRasterSE.createLayer("mylyr", path, null);
66
		} catch (LoadLayerException e) {
67
			e.printStackTrace();
68
		}
69
		
70
		//Creamos el componente
71
		ViewDialog view = new ViewDialog(0, 0, w, h, this);
72
		view.setShowInfo(true);
73
		//Gestor de peticiones a la capa (IExtensionRequest)
74
		ViewRasterRequestManager viewRequestManager = new ViewRasterRequestManager(view, layer);
75
		//Asignamos al componente cual ser? su gestor de peticiones. Cada vez que se pulse un zoom el componente har? 
76
		//una llamada request a su gestor de peticiones
77
		view.setExtensionRequest(viewRequestManager);
78
		view.setCursorSize(w / 2, h / 2);
79
				
80
		frame.setContentPane(view);
81

  
82
		frame.setSize(new java.awt.Dimension(w, h));
83
		frame.setResizable(true);
84
		frame.setTitle("zoom");
85
		frame.setVisible(true);
86
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
87
		
88
		try {
89
			viewRequestManager.initRequest(layer.getFullExtent());
90
		} catch (InvalidRequestException e1) {
91
			System.out.println("Error asignando la vista");
92
		}
93
	}
94
	
95
	class CancellableClass implements Cancellable{
96
		private boolean cancel = false;
97
		public void setCanceled(boolean canceled) {
98
			this.cancel = canceled;
99
		}
100

  
101
		public boolean isCanceled() {
102
			return this.cancel;
103
		}
104
	}
105

  
106
	public void endAction(ToolEvent ev) {
107
	}
108

  
109
	public void offTool(ToolEvent ev) {
110
	}
111

  
112
	public void onTool(ToolEvent ev) {
113
	}
114
	
115
}
tags/tmp_build/extensions/extGeoreferencing/config/text_cs.properties
1
#Translations for language [cs]
2
#Tue May 12 10:57:39 CEST 2009
3
activar=Activate
4
add_errors_csv=
5
affine_algorithm=
6
background_color=Barva pozad\u00ed
7
bicubico=
8
bilinear=
9
brillo=Jas
10
brillo_y_contraste=Jas a kontrats
11
calculando_transformacion=
12
cellsize=
13
center_view=
14
compress=Komprese
15
confirmacion=Potvr\u010f \u017ee
16
contraste=Contrast
17
degree=
18
eliminar_extremos=Odstranit hrany
19
end_georef=
20
end_test_georef=
21
endinfo=Finalization Statistics
22
error_file_exists=Soubor u\u017e existuje. P\u0159ejete si jej p\u0159epsat?
23
error_file_not_writable=Nen\u00ed mo\u017en\u00e9 vytvo\u0159it v\u00fdstupn\u00ed soubor.
24
error_load_layer=
25
error_writer=
26
error_writer_notsupportedextension=
27
espere=Pros\u00edm \u010dekejte
28
file=Soubor
29
full_view=
30
georef_algorithm=
31
georef_file=Georeferen\u010dn\u00ed soubor
32
georef_type=
33
georreferenciacion=
34
georreferenciacion_process=
35
georreferencing_log_message=
36
height=V\u00fd\u0161ka
37
lineal_directo=P\u0159\u00edmo line\u00e1rn\u00ed
38
linf_der=dole vpravo X
39
load_from_ascii=
40
load_from_xml=Na\u010d\u00edst z XML souboru (.rmf)
41
lsup_izq=Naho\u0159e vlevo X
42
more_points=
43
move-point=
44
move_image=
45
msg_save_raster=Operace bude zru\u0161ena. Chcete pokra\u010dovat?
46
mtspixel=Mts/pixel
47
no=No
48
onSharpening=Aktivace doost\u0159ov\u00e1n\u00ed
49
options=Mo\u017enosti
50
output_file=
51
points_panel=
52
polynomial_algorithm=
53
prev_zoom=
54
previsualizacion=Preview
55
props=Vlastnosti
56
realce=vylep\u0161en\u00ed
57
realces=Vylep\u0161en\u00ed
58
recorte_colas=O\u0159ez fronty
59
resolution=Rozli\u0161en\u00ed ??
60
salvar_raster=Ulo\u017eit jako rastr
61
save_gcp_to_xml=
62
save_to_ascii=Exportuj tabulku bod\u016f do textov\u00e9ho souboru.
63
scale=M\u011b\u0159\u00edtko
64
seleccionar_fichero=vyber soubor
65
select=Vyber
66
select_color=
67
select_zoom_area=
68
selectBandaRefinado=V\u00fdb\u011br Panchromatick\u00e9ho p\u00e1sma
69
show_number=
70
size=Velikost
71
table_not_initialize=
72
tarea_en_progreso=B\u011b\u017e\u00edc\u00ed proces
73
test_georef=
74
text_color=
75
time=\u010cas
76
todos_soportados=
77
transformacion=
78
umbral_error=
79
vecino_+_proximo=
80
view_panel=
81
width=Ampl\u00e0ria
82
with_map=
83
without_map=
84
yes=Ano
85
zoom_mas=
86
zoom_menos=
87
zooms_control=
tags/tmp_build/extensions/extGeoreferencing/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="com.iver.cit.gvsig"/>
4
	<libraries library-dir="."/>
5
	<resourceBundle name="text"/>
6
	<extensions>
7
		<extension class-name="org.gvsig.georeferencing.GeoreferencingModule" 
8
			description="Extensi?n encargada activar las herramientas de georeferenciar raster."
9
			active="true" 
10
			priority="1">
11
<!--
12
			<tool-bar name="com.iver.cit.gvsig.raster">
13
				<action-tool 
14
					icon="geolocalization-icon" 
15
					action-command="GEOREFERENCING"  
16
					tooltip="georeferencing"/>	
17
			</tool-bar>
18
-->
19
		</extension>
20
	</extensions>
21
</plugin-config>
tags/tmp_build/extensions/extGeoreferencing/config/text_pt_br.properties
1
#Translations for language [pt_br]
2
#Tue May 12 10:57:39 CEST 2009
3
add_errors_csv=
4
affine_algorithm=
5
background_color=Cor de fundo
6
bicubico=Bicubico
7
bilinear=Bilinear
8
calculando_transformacion=
9
cellsize=
10
center_view=
11
degree=
12
end_georef=
13
end_test_georef=
14
error_load_layer=
15
error_writer=
16
error_writer_notsupportedextension=
17
full_view=
18
georef_algorithm=
19
georef_file=Arquivo de Georreferencia\u00e7\u00e3o
20
georef_type=
21
georreferenciacion=
22
georreferenciacion_process=
23
georreferencing_log_message=
24
load_from_ascii=
25
load_from_xml=Carregar apartir 
26
more_points=
27
move-point=
28
move_image=
29
options=Op\u00e7\u00f5es
30
output_file=
31
points_panel=
32
polynomial_algorithm=
33
prev_zoom=
34
save_gcp_to_xml=
35
save_to_ascii=Exportar tabela de pontos num arquivo de pontos
36
seleccionar_fichero=Selecionar arquivo
37
select=Selecionar
38
select_color=
39
select_zoom_area=
40
show_number=
41
table_not_initialize=
42
test_georef=
43
text_color=
44
todos_soportados=
45
transformacion=
46
umbral_error=
47
vecino_+_proximo=Vizinho mais pr\u00f3ximo
48
view_panel=
49
with_map=
50
without_map=
51
zoom_mas=
52
zoom_menos=
53
zooms_control=
0 54

  
tags/tmp_build/extensions/extGeoreferencing/config/text_fr.properties
1
#Translations for language [fr]
2
#Tue May 12 10:57:39 CEST 2009
3
activar=Activate
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff