Revision 29766

View differences:

tags/tmp_build/extensions/extTopology/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>extTopology</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.jem.workbench.JavaEMFNature</nature>
16
		<nature>org.eclipse.jdt.core.javanature</nature>
17
	</natures>
18
</projectDescription>
tags/tmp_build/extensions/extTopology/src-test/org/gvsig/topology/SnapAndCrackGeoprocessTest.java
1
/*
2
 * Created on 10-abr-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
 *
46
 * $Id: 
47
 * $Log: 
48
 */
49
package org.gvsig.topology;
50

  
51
import java.io.File;
52
import java.net.URL;
53
import java.util.ArrayList;
54
import java.util.HashMap;
55

  
56
import junit.framework.TestCase;
57

  
58
import org.cresques.cts.IProjection;
59
import org.gvsig.topology.ui.util.GUIUtil;
60

  
61
import com.iver.andami.PluginServices;
62
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
63
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
64
import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition;
65
import com.iver.cit.gvsig.fmap.edition.IWriter;
66
import com.iver.cit.gvsig.fmap.edition.ShpSchemaManager;
67
import com.iver.cit.gvsig.fmap.edition.writers.shp.MultiShpWriter;
68
import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter;
69
import com.iver.cit.gvsig.fmap.layers.FLayer;
70
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
71
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
72
import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException;
73
import com.iver.cit.gvsig.geoprocess.core.fmap.XTypes;
74
import com.iver.cit.gvsig.geoprocess.impl.snapandcrack.fmap.SnapAndCrackGeoprocess;
75
import com.iver.utiles.swing.threads.IMonitorableTask;
76

  
77
public class SnapAndCrackGeoprocessTest extends TestCase {
78

  
79
	private File baseDataPath;
80
	private File baseDriversPath;
81
	private IProjection PROJECTION_DEFAULT;
82
	private FLyrVect line1;
83
	private FLyrVect line2;
84
	private FLyrVect poly1;
85
	private FLyrVect poly2;
86

  
87
	public void setUp() throws Exception {
88
		super.setUp();
89
		URL url = SnapAndCrackGeoprocessTest.class.getResource("testdata/testsnapandcrack/originales");
90
		if (url == null)
91
			throw new Exception(
92
					"No se encuentra el directorio con datos de prueba");
93

  
94
		baseDataPath = new File(url.getFile());
95
		if (!baseDataPath.exists())
96
			throw new Exception(
97
					"No se encuentra el directorio con datos de prueba");
98

  
99
		baseDriversPath = new File(
100
				"../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
101
		if (!baseDriversPath.exists())
102
			throw new Exception("Can't find drivers path ");
103
		com.iver.cit.gvsig.fmap.layers.LayerFactory
104
				.setDriversPath(baseDriversPath.getAbsolutePath());
105
		LayerFactory.setWritersPath(baseDriversPath.getAbsolutePath());
106
		if (LayerFactory.getDM().getDriverNames().length < 1)
107
			throw new Exception("Can't find drivers in path: "
108
					+ baseDriversPath);
109
		PROJECTION_DEFAULT = CRSFactory.getCRS("EPSG:23030");
110
		
111
		
112
		line1 = (FLyrVect) newLayer("lineas1.shp", "gvSIG shp driver");
113
		line2 = (FLyrVect) newLayer("lineas2.shp", "gvSIG shp driver");
114
		poly1 = (FLyrVect) newLayer("poligonos1.shp",
115
				"gvSIG shp driver");
116
		poly2 = (FLyrVect) newLayer("poligonos2.shp",
117
				"gvSIG shp driver");
118

  
119
		// TODO Esto quizas deba hacerlo el geoproceso
120
		line1.createSpatialIndex();
121
		line2.createSpatialIndex();
122
		poly1.createSpatialIndex();
123
		poly2.createSpatialIndex();
124

  
125
	}
126

  
127
	public FLayer newLayer(String fileName, String driverName)
128
			throws LoadLayerException {
129
		FLayer solution = null;
130
		File file = new File(baseDataPath, fileName);
131
		solution = com.iver.cit.gvsig.fmap.layers.LayerFactory.createLayer(
132
				fileName, driverName, file, PROJECTION_DEFAULT);
133
		solution.setAvailable(true);
134
		return solution;
135

  
136
	}
137
	
138
	
139
	
140
	public void testSnapAndCrack1() throws LoadLayerException{
141
		//crack and snap line1
142
		ArrayList<FLayer> crackingLyrs = new ArrayList<FLayer>();
143
		crackingLyrs.add(poly1);
144
		crackingLyrs.add(line2);
145
		crackingLyrs.add(poly2);
146
		
147
		testSnapAndCrackGeoprocess(line1, crackingLyrs);
148
	}
149
	
150
	public void testSnapAndCrack2() throws LoadLayerException{
151
		ArrayList<FLayer> crackingLyrs = new ArrayList<FLayer>();
152
		crackingLyrs.add(line1);
153
		crackingLyrs.add(line2);
154
		crackingLyrs.add(poly2);
155
		
156
		testSnapAndCrackGeoprocess(poly1, crackingLyrs);
157
	}
158
	
159
	public void testSnapAndCrack3() throws LoadLayerException{
160
		ArrayList<FLayer> crackingLyrs = new ArrayList<FLayer>();
161
		crackingLyrs.add(poly1);
162
		crackingLyrs.add(line1);
163
		crackingLyrs.add(poly2);
164
		
165
		testSnapAndCrackGeoprocess(line2, crackingLyrs);
166
	}
167
	
168
	public void testSnapAndCrack4() throws LoadLayerException{
169
		ArrayList<FLayer> crackingLyrs = new ArrayList<FLayer>();
170
		crackingLyrs.add(poly1);
171
		crackingLyrs.add(line1);
172
		crackingLyrs.add(line2);
173
		
174
		testSnapAndCrackGeoprocess(poly2, crackingLyrs);
175
	}
176

  
177
	public void testSnapAndCrackGeoprocess(FLyrVect inputLyr, ArrayList<FLayer> crackingLyrs) throws LoadLayerException {
178
		double clusterTolerance = 1;
179

  
180
		SnapAndCrackGeoprocess geoprocess = new SnapAndCrackGeoprocess(inputLyr,
181
				crackingLyrs);
182
		String temp = System.getProperty("java.io.tmpdir") + inputLyr.getName();
183
		File newFile = new File(temp);
184
		SHPLayerDefinition definition = (SHPLayerDefinition) geoprocess
185
				.createLayerDefinition();
186
		definition.setFile(newFile);
187
		ShpSchemaManager schemaManager = new ShpSchemaManager(newFile
188
				.getAbsolutePath());
189
		IWriter writer = null;
190
		try {
191
			schemaManager.createSchema(definition);
192
			int shapeType = definition.getShapeType();
193
			if (shapeType != XTypes.MULTI) {
194
				writer = new ShpWriter();
195
				((ShpWriter) writer).setFile(definition.getFile());
196
			} else {
197
				writer = new MultiShpWriter();
198
				((MultiShpWriter) writer).setFile(definition.getFile());
199
			}
200
			writer.initialize(definition);
201
		} catch (Exception e1) {
202
			String error = PluginServices.getText(this,
203
					"Error_escritura_resultados");
204
			String errorDescription = PluginServices.getText(this,
205
					"Error_preparar_escritura_resultados");
206
			GUIUtil.getInstance().messageBox(error, errorDescription);
207
		}
208

  
209
		geoprocess.setResultLayerProperties(writer, schemaManager);
210
		HashMap params = new HashMap();
211
		Double snapTolerance = new Double(clusterTolerance);
212
		params.put("snap_tolerance", snapTolerance);
213

  
214
		try {
215
			geoprocess.setParameters(params);
216
			geoprocess.checkPreconditions();
217
			IMonitorableTask task = geoprocess.createTask();
218

  
219
			task.run();
220

  
221
			FLyrVect result = (FLyrVect) geoprocess.getResult();
222

  
223
			System.out.println("numero de geometrias de la capa resultado :"
224
					+ result.getSource().getShapeCount());
225
			
226
		} catch (GeoprocessException e1) {
227
			// TODO Auto-generated catch block
228
			e1.printStackTrace();
229
		} catch (Exception e) {
230
			// TODO Auto-generated catch block
231
			e.printStackTrace();
232
		}
233
	}
234

  
235
}
tags/tmp_build/extensions/extTopology/src-test/org/gvsig/topology/VoronoiGeoprocessTest.java
1
/*
2
 * Created on 10-abr-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: 
47
* $Log: 
48
*/
49
package org.gvsig.topology;
50

  
51
import java.awt.geom.Point2D;
52
import java.io.File;
53
import java.net.URL;
54
import java.util.List;
55

  
56
import junit.framework.TestCase;
57

  
58
import org.cresques.cts.IProjection;
59
import org.gvsig.exceptions.BaseException;
60
import org.gvsig.jts.voronoi.TriangleFeature;
61
import org.gvsig.jts.voronoi.VoronoiAndTinInputLyr;
62
import org.gvsig.jts.voronoi.Voronoier;
63

  
64
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
65
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
66
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
67
import com.iver.cit.gvsig.fmap.core.IGeometry;
68
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
69
import com.iver.cit.gvsig.fmap.layers.FLayer;
70
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
71
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
72
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
73

  
74
public class VoronoiGeoprocessTest extends TestCase {
75
	
76
	private File baseDataPath;
77
	private File baseDriversPath;
78
	private IProjection PROJECTION_DEFAULT;
79
	
80
	private FLyrVect pointLyr;
81
	
82
	public void setUp() throws Exception {
83
		super.setUp();
84
		URL url = VoronoiGeoprocessTest.class.getResource("testdata/testvoronoi");
85
		if (url == null)
86
			throw new Exception(
87
					"No se encuentra el directorio con datos de prueba");
88

  
89
		baseDataPath = new File(url.getFile());
90
		if (!baseDataPath.exists())
91
			throw new Exception(
92
					"No se encuentra el directorio con datos de prueba");
93

  
94
		baseDriversPath = new File(
95
				"../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
96
		if (!baseDriversPath.exists())
97
			throw new Exception("Can't find drivers path ");
98
		com.iver.cit.gvsig.fmap.layers.LayerFactory
99
				.setDriversPath(baseDriversPath.getAbsolutePath());
100
		LayerFactory.setWritersPath(baseDriversPath.getAbsolutePath());
101
		if (LayerFactory.getDM().getDriverNames().length < 1)
102
			throw new Exception("Can't find drivers in path: "
103
					+ baseDriversPath);
104
		PROJECTION_DEFAULT = CRSFactory.getCRS("EPSG:23030");
105
		
106
		
107
		pointLyr = (FLyrVect) newLayer("SAIH.shp", "gvSIG shp driver");
108
		
109

  
110
	}
111

  
112
	public FLayer newLayer(String fileName, String driverName)
113
			throws LoadLayerException {
114
		FLayer solution = null;
115
		File file = new File(baseDataPath, fileName);
116
		solution = com.iver.cit.gvsig.fmap.layers.LayerFactory.createLayer(
117
				fileName, driverName, file, PROJECTION_DEFAULT);
118
		solution.setAvailable(true);
119
		return solution;
120
	}
121
	
122
	public void test1() throws ReadDriverException{
123
		VoronoiAndTinInputLyr inputLyr = new VoronoiAndTinInputLyr(){
124
			
125
			private final FLyrVect lyr = pointLyr;
126
			
127
			public ReadableVectorial getSource(){
128
				return lyr.getSource();
129
			}
130
			
131
			public Point2D getPoint(int geometryIndex) {
132
				try {
133
					IGeometry shape = lyr.getSource().getShape(geometryIndex);
134
					com.iver.cit.gvsig.fmap.core.Handler[] handlers = shape.getHandlers(IGeometry.SELECTHANDLER);
135
					return handlers[0].getPoint();
136
				} catch (ExpansionFileReadException e) {
137
					e.printStackTrace();
138
					return null;
139
				} catch (ReadDriverException e) {
140
					e.printStackTrace();
141
					return null;
142
				}
143
			}};
144
			
145
		List<TriangleFeature> featureCollection;
146
		try {
147
			featureCollection = Voronoier.createTIN(inputLyr,false, "CHEN", null);
148
			assertTrue(featureCollection.size() != 0);
149
			
150
			featureCollection = Voronoier.createTIN(inputLyr, false, "CHEW", null);
151
			assertTrue(featureCollection.size() != 0);
152
		} catch (BaseException e) {
153
			// TODO Auto-generated catch block
154
			e.printStackTrace();
155
		}
156
		
157
	}
158
}
tags/tmp_build/extensions/extTopology/src-test/org/gvsig/topology/testdata/testvoronoi/SAIH.prj
1
PROJCS["ED_1950_UTM_Zone_30N",GEOGCS["GCS_European_1950",DATUM["D_European_1950",SPHEROID["International_1924",6378388.0,297.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-3.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
tags/tmp_build/extensions/extTopology/src-test/org/gvsig/topology/PolyToLinesGeoprocessTest.java
1
/*
2
 * Created on 10-abr-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: 
47
* $Log: 
48
*/
49
package org.gvsig.topology;
50

  
51
import java.io.File;
52
import java.net.URL;
53
import java.util.HashMap;
54

  
55
import junit.framework.TestCase;
56

  
57
import org.cresques.cts.IProjection;
58
import org.gvsig.topology.ui.util.GUIUtil;
59

  
60
import com.iver.andami.PluginServices;
61
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
62
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
63
import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition;
64
import com.iver.cit.gvsig.fmap.edition.IWriter;
65
import com.iver.cit.gvsig.fmap.edition.ShpSchemaManager;
66
import com.iver.cit.gvsig.fmap.edition.writers.shp.MultiShpWriter;
67
import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter;
68
import com.iver.cit.gvsig.fmap.layers.FLayer;
69
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
70
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
71
import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException;
72
import com.iver.cit.gvsig.geoprocess.core.fmap.XTypes;
73
import com.iver.cit.gvsig.geoprocess.impl.polytolines.fmap.PolyToLinesGeoprocess;
74
import com.iver.utiles.swing.threads.IMonitorableTask;
75

  
76
public class PolyToLinesGeoprocessTest extends TestCase {
77
	
78
	private File baseDataPath;
79
	private File baseDriversPath;
80
	private IProjection PROJECTION_DEFAULT;
81
	private FLyrVect poly1;
82

  
83
	public void setUp() throws Exception {
84
		super.setUp();
85
		URL url = PolyToLinesGeoprocessTest.class.getResource("testdata");
86
		if (url == null)
87
			throw new Exception(
88
					"No se encuentra el directorio con datos de prueba");
89

  
90
		baseDataPath = new File(url.getFile());
91
		if (!baseDataPath.exists())
92
			throw new Exception(
93
					"No se encuentra el directorio con datos de prueba");
94

  
95
		baseDriversPath = new File(
96
				"../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
97
		if (!baseDriversPath.exists())
98
			throw new Exception("Can't find drivers path ");
99
		com.iver.cit.gvsig.fmap.layers.LayerFactory
100
				.setDriversPath(baseDriversPath.getAbsolutePath());
101
		LayerFactory.setWritersPath(baseDriversPath.getAbsolutePath());
102
		if (LayerFactory.getDM().getDriverNames().length < 1)
103
			throw new Exception("Can't find drivers in path: "
104
					+ baseDriversPath);
105
		PROJECTION_DEFAULT = CRSFactory.getCRS("EPSG:23030");
106
		
107
		poly1 = (FLyrVect) newLayer("poligonos.shp",
108
				"gvSIG shp driver");
109
		poly1.createSpatialIndex();
110

  
111
	}
112

  
113
	public FLayer newLayer(String fileName, String driverName)
114
			throws LoadLayerException {
115
		FLayer solution = null;
116
		File file = new File(baseDataPath, fileName);
117
		solution = com.iver.cit.gvsig.fmap.layers.LayerFactory.createLayer(
118
				fileName, driverName, file, PROJECTION_DEFAULT);
119
		solution.setAvailable(true);
120
		return solution;
121

  
122
	}
123
	
124
	
125
	
126
	public void test1(){
127
		
128
		PolyToLinesGeoprocess geoprocess = new PolyToLinesGeoprocess(poly1);
129
		String temp = System.getProperty("java.io.tmpdir") + poly1.getName();
130
		File newFile = new File(temp);
131
		SHPLayerDefinition definition = (SHPLayerDefinition) geoprocess
132
				.createLayerDefinition();
133
		definition.setFile(newFile);
134
		ShpSchemaManager schemaManager = new ShpSchemaManager(newFile
135
				.getAbsolutePath());
136
		IWriter writer = null;
137
		try {
138
			schemaManager.createSchema(definition);
139
			int shapeType = definition.getShapeType();
140
			if (shapeType != XTypes.MULTI) {
141
				writer = new ShpWriter();
142
				((ShpWriter) writer).setFile(definition.getFile());
143
			} else {
144
				writer = new MultiShpWriter();
145
				((MultiShpWriter) writer).setFile(definition.getFile());
146
			}
147
			writer.initialize(definition);
148
		} catch (Exception e1) {
149
			String error = PluginServices.getText(this,
150
					"Error_escritura_resultados");
151
			String errorDescription = PluginServices.getText(this,
152
					"Error_preparar_escritura_resultados");
153
			GUIUtil.getInstance().messageBox(error, errorDescription);
154
		}
155

  
156
		geoprocess.setResultLayerProperties(writer, schemaManager);
157
		
158
		HashMap params = new HashMap();
159
		Boolean selected = new Boolean(false);
160
		params.put("layer_selection", selected);
161

  
162
		try {
163
			geoprocess.setParameters(params);
164
			geoprocess.checkPreconditions();
165
			IMonitorableTask task = geoprocess.createTask();
166

  
167
			task.run();
168

  
169
			FLyrVect result = (FLyrVect) geoprocess.getResult();
170

  
171
			System.out.println("numero de geometrias de la capa resultado :"
172
					+ result.getSource().getShapeCount());
173
			
174
		} catch (GeoprocessException e1) {
175
			// TODO Auto-generated catch block
176
			e1.printStackTrace();
177
		} catch (Exception e) {
178
			// TODO Auto-generated catch block
179
			e.printStackTrace();
180
		}
181
	}
182
}
tags/tmp_build/extensions/extTopology/src-test/com/iver/cit/gvsig/referencing/VectorialReferencingPanelTest.java
1
/*
2
 * Created on 10-abr-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: 
47
* $Log: 
48
*/
49
package com.iver.cit.gvsig.referencing;
50

  
51
import java.awt.Graphics2D;
52
import java.awt.Image;
53
import java.awt.geom.Point2D;
54
import java.awt.geom.Rectangle2D;
55
import java.awt.image.BufferedImage;
56
import java.net.URI;
57
import java.util.List;
58
import java.util.Map;
59

  
60
import javax.print.attribute.PrintRequestAttributeSet;
61
import javax.swing.ImageIcon;
62

  
63
import org.cresques.cts.ICoordTrans;
64
import org.cresques.cts.IProjection;
65
import org.gvsig.exceptions.BaseException;
66

  
67
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
68
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
69
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
70
import com.iver.cit.gvsig.exceptions.layers.ReloadLayerException;
71
import com.iver.cit.gvsig.exceptions.layers.StartEditionLayerException;
72
import com.iver.cit.gvsig.fmap.MapContext;
73
import com.iver.cit.gvsig.fmap.ViewPort;
74
import com.iver.cit.gvsig.fmap.layers.AbstractLinkProperties;
75
import com.iver.cit.gvsig.fmap.layers.FLayer;
76
import com.iver.cit.gvsig.fmap.layers.FLayerStatus;
77
import com.iver.cit.gvsig.fmap.layers.FLayers;
78
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
79
import com.iver.cit.gvsig.fmap.layers.LayerListener;
80
import com.iver.cit.gvsig.fmap.layers.XMLException;
81
import com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer;
82
import com.iver.utiles.XMLEntity;
83
import com.iver.utiles.swing.threads.Cancellable;
84

  
85
import junit.framework.TestCase;
86

  
87
public class VectorialReferencingPanelTest extends TestCase {
88
	public void testPanel(){
89
javax.swing.JFrame f = new javax.swing.JFrame();
90
		
91
		FLayers lyrs = new FLayers();
92
		lyrs.addLayer(new FLyrVect(){
93

  
94
			public void addError(BaseException exception) {
95
				// TODO Auto-generated method stub
96
				
97
			}
98

  
99
			public boolean addLayerListener(LayerListener o) {
100
				// TODO Auto-generated method stub
101
				return false;
102
			}
103

  
104
			public boolean allowLinks() {
105
				// TODO Auto-generated method stub
106
				return false;
107
			}
108

  
109
			public FLayer cloneLayer() throws Exception {
110
				// TODO Auto-generated method stub
111
				return null;
112
			}
113

  
114
			public void draw(BufferedImage image, Graphics2D g,
115
					ViewPort viewPort, Cancellable cancel, double scale)
116
					throws ReadDriverException {
117
				// TODO Auto-generated method stub
118
				
119
			}
120

  
121
			public BufferedImage getCacheImageDrawnLayers() {
122
				// TODO Auto-generated method stub
123
				return null;
124
			}
125

  
126
			public ICoordTrans getCoordTrans() {
127
				// TODO Auto-generated method stub
128
				return null;
129
			}
130

  
131
			public BaseException getError(int i) {
132
				// TODO Auto-generated method stub
133
				return null;
134
			}
135

  
136
			public List getErrors() {
137
				// TODO Auto-generated method stub
138
				return null;
139
			}
140

  
141
			public Map getExtendedProperties() {
142
				// TODO Auto-generated method stub
143
				return null;
144
			}
145

  
146
			public FLayerStatus getFLayerStatus() {
147
				// TODO Auto-generated method stub
148
				return null;
149
			}
150

  
151
			public Rectangle2D getFullExtent() throws ReadDriverException,
152
					ExpansionFileReadException {
153
				// TODO Auto-generated method stub
154
				return null;
155
			}
156

  
157
			public String getInfoString() {
158
				// TODO Auto-generated method stub
159
				return null;
160
			}
161

  
162
			public LayerListener[] getLayerListeners() {
163
				// TODO Auto-generated method stub
164
				return null;
165
			}
166

  
167
			public URI[] getLink(Point2D point, double tolerance) {
168
				// TODO Auto-generated method stub
169
				return null;
170
			}
171

  
172
			public AbstractLinkProperties getLinkProperties() {
173
				// TODO Auto-generated method stub
174
				return null;
175
			}
176

  
177
			public MapContext getMapContext() {
178
				// TODO Auto-generated method stub
179
				return null;
180
			}
181

  
182
			public double getMaxScale() {
183
				// TODO Auto-generated method stub
184
				return 0;
185
			}
186

  
187
			public double getMinScale() {
188
				// TODO Auto-generated method stub
189
				return 0;
190
			}
191

  
192
			public String getName() {
193
				// TODO Auto-generated method stub
194
				return "kk";
195
			}
196

  
197
			public int getNumErrors() {
198
				// TODO Auto-generated method stub
199
				return 0;
200
			}
201

  
202
			public FLayers getParentLayer() {
203
				// TODO Auto-generated method stub
204
				return null;
205
			}
206

  
207
			public Object getProperty(Object key) {
208
				// TODO Auto-generated method stub
209
				return null;
210
			}
211

  
212
			public ImageIcon getTocImageIcon() {
213
				// TODO Auto-generated method stub
214
				return null;
215
			}
216

  
217
			public Image getTocStatusImage() {
218
				// TODO Auto-generated method stub
219
				return null;
220
			}
221

  
222
			public XMLEntity getXMLEntity() throws XMLException {
223
				// TODO Auto-generated method stub
224
				return null;
225
			}
226

  
227
			public boolean isActive() {
228
				// TODO Auto-generated method stub
229
				return false;
230
			}
231

  
232
			public boolean isAvailable() {
233
				// TODO Auto-generated method stub
234
				return false;
235
			}
236

  
237
			public boolean isCachingDrawnLayers() {
238
				// TODO Auto-generated method stub
239
				return false;
240
			}
241

  
242
			public boolean isDirty() {
243
				// TODO Auto-generated method stub
244
				return false;
245
			}
246

  
247
			public boolean isEditing() {
248
				// TODO Auto-generated method stub
249
				return false;
250
			}
251

  
252
			public boolean isInTOC() {
253
				// TODO Auto-generated method stub
254
				return false;
255
			}
256

  
257
			public boolean isOk() {
258
				// TODO Auto-generated method stub
259
				return false;
260
			}
261

  
262
			public boolean isVisible() {
263
				// TODO Auto-generated method stub
264
				return false;
265
			}
266

  
267
			public boolean isWithinScale(double scale) {
268
				// TODO Auto-generated method stub
269
				return false;
270
			}
271

  
272
			public boolean isWritable() {
273
				// TODO Auto-generated method stub
274
				return false;
275
			}
276

  
277
			public void load() throws LoadLayerException {
278
				// TODO Auto-generated method stub
279
				
280
			}
281

  
282
			public ComposedLayer newComposedLayer() {
283
				// TODO Auto-generated method stub
284
				return null;
285
			}
286

  
287
			public void print(Graphics2D g, ViewPort viewPort,
288
					Cancellable cancel, double scale,
289
					PrintRequestAttributeSet properties)
290
					throws ReadDriverException {
291
				// TODO Auto-generated method stub
292
				
293
			}
294

  
295
			public void reload() throws ReloadLayerException {
296
				// TODO Auto-generated method stub
297
				
298
			}
299

  
300
			public boolean removeLayerListener(LayerListener o) {
301
				// TODO Auto-generated method stub
302
				return false;
303
			}
304

  
305
			public void setActive(boolean selected) {
306
				// TODO Auto-generated method stub
307
				
308
			}
309

  
310
			public void setAvailable(boolean available) {
311
				// TODO Auto-generated method stub
312
				
313
			}
314

  
315
			public void setCacheImageDrawnLayers(
316
					BufferedImage cacheImageDrawnLayers) {
317
				// TODO Auto-generated method stub
318
				
319
			}
320

  
321
			public void setCachingDrawnLayers(boolean cacheDrawnLayers) {
322
				// TODO Auto-generated method stub
323
				
324
			}
325

  
326
			public void setCoordTrans(ICoordTrans ct) {
327
				// TODO Auto-generated method stub
328
				
329
			}
330

  
331
			public void setDirty(boolean dirty) {
332
				// TODO Auto-generated method stub
333
				
334
			}
335

  
336
			public void setEditing(boolean b) throws StartEditionLayerException {
337
				// TODO Auto-generated method stub
338
				
339
			}
340

  
341
			public void setFLayerStatus(FLayerStatus status) {
342
				// TODO Auto-generated method stub
343
				
344
			}
345

  
346
			public void setInTOC(boolean b) {
347
				// TODO Auto-generated method stub
348
				
349
			}
350

  
351
			public void setMaxScale(double maxScale) {
352
				// TODO Auto-generated method stub
353
				
354
			}
355

  
356
			public void setMinScale(double minScale) {
357
				// TODO Auto-generated method stub
358
				
359
			}
360

  
361
			public void setName(String name) {
362
				// TODO Auto-generated method stub
363
				
364
			}
365

  
366
			public void setParentLayer(FLayers root) {
367
				// TODO Auto-generated method stub
368
				
369
			}
370

  
371
			public void setProperty(Object key, Object obj) {
372
				// TODO Auto-generated method stub
373
				
374
			}
375

  
376
			public void setVisible(boolean visibility) {
377
				// TODO Auto-generated method stub
378
				
379
			}
380

  
381
			public void setXMLEntity(XMLEntity xml) throws XMLException {
382
				// TODO Auto-generated method stub
383
				
384
			}
385

  
386
			public void setXMLEntity03(XMLEntity xml) throws XMLException {
387
				// TODO Auto-generated method stub
388
				
389
			}
390

  
391
			public boolean visibleRequired() {
392
				// TODO Auto-generated method stub
393
				return false;
394
			}
395

  
396
			public IProjection getProjection() {
397
				// TODO Auto-generated method stub
398
				return null;
399
			}
400

  
401
			public void reProject(ICoordTrans ct) {
402
				// TODO Auto-generated method stub
403
				
404
			}});
405
		
406
		
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff