Revision 39232

View differences:

tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Tue Nov 13 15:33:23 CET 2012
3
buildNumber=2070
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/src-test/org/gvsig/fmap/dal/store/gpe/GPETest.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
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31

  
32
import org.gvsig.fmap.crs.CRSFactory;
33
import org.gvsig.fmap.dal.DataStoreParameters;
34
import org.gvsig.fmap.dal.exception.DataException;
35
import org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore;
36
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
37
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
38
import org.gvsig.gpe.lib.api.GPELocator;
39
import org.gvsig.gpe.lib.api.GPEManager;
40

  
41
/**
42
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
43
 */
44
public class GPETest extends BaseTestEditableFeatureStore {
45
	public static final File file_prueba = new File("testdata/GML-points.gml");
46

  
47
	private FilesystemServerExplorer myExplorer = null;
48
	private GPEManager gpeManager = null;
49

  
50
	protected void doSetUp() throws Exception {
51
		super.doSetUp();
52
		gpeManager = GPELocator.getGPEManager();
53
	}
54

  
55
	/*
56
	 * (non-Javadoc)
57
	 *
58
	 * @see
59
	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
60
	 * ()
61
	 */
62
	public DataStoreParameters getDefaultDataStoreParameters()
63
	throws DataException {
64
		GPEStoreParameters parameters = null;
65

  
66
		parameters = (GPEStoreParameters) dataManager
67
		.createStoreParameters(GPEStoreProvider.NAME);
68

  
69
		parameters.setFileName(file_prueba.getAbsolutePath());
70
		parameters.setCRS(CRSFactory.getCRS("EPSG:23030"));
71
		return parameters;
72
	}
73

  
74
	/*
75
	 * (non-Javadoc)
76
	 *
77
	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
78
	 */
79
	public boolean hasExplorer() {
80
		return false;
81
	}
82

  
83
	/* (non-Javadoc)
84
	 * @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#getDefaultNewDataStoreParameters()
85
	 */
86
	public NewFeatureStoreParameters getDefaultNewDataStoreParameters()
87
	throws Exception {
88
		return null;
89
//		if (this.myExplorer == null) {
90
//			GPEStoreParameters gpeStoreParameters = (GPEStoreParameters) this
91
//			.getDefaultDataStoreParameters();
92
//			FeatureStore store = (FeatureStore) dataManager
93
//			.createStore(gpeStoreParameters);
94
//			myExplorer = (FilesystemServerExplorer) store.getExplorer();
95
//			store.dispose();
96
//		}
97
//
98
//		return (NewFeatureStoreParameters) myExplorer
99
//		.getAddParameters(dbf_prueba_destino);
100
	}
101

  
102
	/* (non-Javadoc)
103
	 * @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#usesResources()
104
	 */
105
	public boolean usesResources() {
106
		// TODO Auto-generated method stub
107
		return false;
108
	}
109

  
110
	public boolean resourcesNotifyChanges() {
111
		return true;
112
	}
113

  
114

  
115
}
116

  
0 117

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/src-test/org/gvsig/fmap/dal/store/gpe/GPEMobileTest.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
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31
import java.util.Iterator;
32

  
33
import junit.framework.TestCase;
34

  
35
import org.gvsig.compat.se.SECompatLibrary;
36
import org.gvsig.fmap.dal.DALFileLibrary;
37
import org.gvsig.fmap.dal.DALLibrary;
38
import org.gvsig.fmap.dal.DALLocator;
39
import org.gvsig.fmap.dal.DataManager;
40
import org.gvsig.fmap.dal.DataStoreParameters;
41
import org.gvsig.fmap.dal.exception.DataException;
42
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
43
import org.gvsig.fmap.dal.feature.Feature;
44
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
45
import org.gvsig.fmap.dal.feature.FeatureSet;
46
import org.gvsig.fmap.dal.feature.FeatureStore;
47
import org.gvsig.fmap.dal.feature.FeatureType;
48
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
49
import org.gvsig.fmap.dal.impl.DALDefaultImplLibrary;
50
import org.gvsig.fmap.dal.impl.DefaultDataManager;
51
import org.gvsig.fmap.dal.index.spatial.jts.JTSIndexLibrary;
52
import org.gvsig.fmap.dal.resource.impl.DefaultResourceManager;
53
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
54
import org.gvsig.fmap.geom.Geometry;
55
import org.gvsig.fmap.geom.impl.DefaultGeometryLibrary;
56
import org.gvsig.fmap.geom.primitive.Envelope;
57
import org.gvsig.gpe.lib.api.GPELocator;
58
import org.gvsig.gpe.lib.api.GPEManager;
59
import org.gvsig.tools.ToolsLibrary;
60
import org.gvsig.tools.persistence.xml.XMLPersistenceLibrary;
61

  
62
/**
63
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
64
 */
65
public class GPEMobileTest extends TestCase{
66
	public static final File file_prueba = new File("testdata/GML-points.gml");
67

  
68
	private FilesystemServerExplorer myExplorer = null;
69
	private GPEManager gpeManager = null;
70

  
71
	private boolean baseTestInitialized=false;
72

  
73
	private DataManager dataManager;
74

  
75
	private FeatureStore store;
76

  
77
	public void setUp(){
78
		DALLocator.registerDataManager(DefaultDataManager.class);
79
		DALLocator.registerResourceManager(DefaultResourceManager.class);
80
		if (baseTestInitialized) {
81
			return;
82
		}
83
		
84
		ToolsLibrary tools = new ToolsLibrary();
85
		tools.initialize();
86
		tools.postInitialize();
87

  
88
		XMLPersistenceLibrary xmlPersistence = new XMLPersistenceLibrary();
89
		xmlPersistence.initialize();
90
		xmlPersistence.postInitialize();
91

  
92
		DALLocator.registerDataManager(DefaultDataManager.class);
93
		DALLocator.registerResourceManager(DefaultResourceManager.class);
94
		
95
		DALLibrary lib = new DALLibrary();
96
		lib.initialize();
97
		lib.postInitialize();
98

  
99
		DALDefaultImplLibrary libImpl = new DALDefaultImplLibrary();
100
		libImpl.initialize();
101
		libImpl.postInitialize();		
102

  
103
		DALFileLibrary libFile = new DALFileLibrary();
104
		libFile.initialize();
105
		libFile.postInitialize();
106

  
107
		DefaultGeometryLibrary defGeomLib = new DefaultGeometryLibrary();
108
		defGeomLib.initialize();
109
		defGeomLib.postInitialize();
110

  
111
		JTSIndexLibrary jtsIndex = new JTSIndexLibrary();
112
		jtsIndex.initialize();
113
		jtsIndex.postInitialize();
114
		
115
//		DefaultGPEDataTypesLibrary gpeDataTypesLibrary = new DefaultGPEDataTypesLibrary();
116
//		gpeDataTypesLibrary.initialize();
117
//		gpeDataTypesLibrary.postInitialize();
118
		 
119
		DALGPELibrary gpeLibrary = new DALGPELibrary();
120
		gpeLibrary.initialize();
121
		gpeLibrary.postInitialize();
122
		
123
//		DefaultGPELibrary defaultGPElibrary = new DefaultGPELibrary();
124
//		defaultGPElibrary.initialize();
125
//		defaultGPElibrary.postInitialize();		
126
//		
127
		
128
//		DefaultXmlLibrary defaultXmllibrary = new DefaultXmlLibrary();
129
//		defaultXmllibrary.initialize();
130
//		defaultXmllibrary.postInitialize();
131
		
132
//		DefaultKmlLibrary kmlLibrary = new DefaultKmlLibrary();
133
//		kmlLibrary.initialize();
134
//		kmlLibrary.postInitialize();
135
		
136
//		DefaultGmlLibrary gmlLibrary = new DefaultGmlLibrary();
137
//		gmlLibrary.initialize();
138
//		gmlLibrary.postInitialize();	
139
		
140
		SECompatLibrary compatLibrary = new SECompatLibrary();
141
		compatLibrary.initialize();
142
		compatLibrary.postInitialize();
143

  
144
		gpeManager = GPELocator.getGPEManager();
145
		
146
		dataManager = DALLocator.getDataManager();
147
		
148
		baseTestInitialized = true;
149
	}
150

  
151

  
152
	public void testGetDataStore(){
153
		try {
154
			DataStoreParameters params = this.getDefaultDataStoreParameters();
155
			store = (FeatureStore)dataManager.createStore(params);			
156
			//gpestore.setParserName("GML");
157
			
158
			FeatureSet set;
159
			// FeatureType type = store.getDefaultFeatureType();
160
			
161
			set = store.getFeatureSet();
162

  
163
			System.out.println("Feature count: " + set.getSize());
164
			Iterator it = set.iterator();
165
			// Iterator ftIt;
166
			// FeatureAttributeDescriptor desc;
167

  
168
			int i = 0;
169
			Feature feature;
170
			while (it.hasNext()) {
171
				// ftIt = type.iterator();
172

  
173
				System.out.println("=====================================");
174
				System.out.println("Feature " + i + ": ");
175
				System.out.println("-------------------------------------");
176
				feature = (Feature) it.next();
177
				Geometry geom = (Geometry) feature.getDefaultGeometry(); // .getGeometries().get(0);
178
				
179
				FeatureType ft = feature.getType();
180
				FeatureAttributeDescriptor[] atts = ft.getAttributeDescriptors();
181
				int len = atts.length;
182
				FeatureAttributeDescriptor att;
183
				for (int j=0; j<len; j++) {
184
					att = ft.getAttributeDescriptor(j);
185
					System.out.println("ATT: " + att.getName() + "; VAL = " + feature.get(j).toString());
186
				}
187
				System.out.println("-------------------------------------");
188
				Envelope env = geom.getEnvelope();
189
				System.out.println("GEOM BB: "
190
						+ env.getMinimum(0)
191
						+ ", " + env.getMinimum(1)
192
						+ ", " + env.getMaximum(0)
193
						+ ", " + env.getMaximum(1));
194
				System.out.println("=====================================");
195
				i++;
196
			}
197
			set.dispose();
198
			store.dispose();
199
		} catch (DataException e) {
200
			// TODO Auto-generated catch block
201
			e.printStackTrace();
202
		} catch (ValidateDataParametersException e) {
203
			// TODO Auto-generated catch block
204
			e.printStackTrace();
205
		}
206
	}
207

  
208
	/*
209
	 * (non-Javadoc)
210
	 *
211
	 * @see
212
	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
213
	 * ()
214
	 */
215
	public DataStoreParameters getDefaultDataStoreParameters()
216
	throws DataException {
217
		GPEStoreParameters parameters = null;
218

  
219
		parameters = (GPEStoreParameters) dataManager
220
		.createStoreParameters(GPEStoreProvider.NAME);
221

  
222
		parameters.setFileName(file_prueba.getAbsolutePath());
223
		//IProjection proj = null; 
224
		// parameters.setSRS(CRSFactory.getCRS("ESPG:23030"));
225
		//parameters.setSRS(proj);
226
		
227
		return parameters;
228
	}
229

  
230
	/*
231
	 * (non-Javadoc)
232
	 *
233
	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
234
	 */
235
	public boolean hasExplorer() {
236
		return false;
237
	}
238

  
239
	/* (non-Javadoc)
240
	 * @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#getDefaultNewDataStoreParameters()
241
	 */
242
	public NewFeatureStoreParameters getDefaultNewDataStoreParameters()
243
	throws Exception {
244
		return null;
245
//		if (this.myExplorer == null) {
246
//			GPEStoreParameters gpeStoreParameters = (GPEStoreParameters) this
247
//			.getDefaultDataStoreParameters();
248
//			FeatureStore store = (FeatureStore) dataManager
249
//			.createStore(gpeStoreParameters);
250
//			myExplorer = (FilesystemServerExplorer) store.getExplorer();
251
//			store.dispose();
252
//		}
253
//
254
//		return (NewFeatureStoreParameters) myExplorer
255
//		.getAddParameters(dbf_prueba_destino);
256
	}
257

  
258
	/* (non-Javadoc)
259
	 * @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#usesResources()
260
	 */
261
	public boolean usesResources() {
262
		// TODO Auto-generated method stub
263
		return false;
264
	}
265

  
266
	public boolean resourcesNotifyChanges() {
267
		return true;
268
	}
269

  
270
}
271

  
0 272

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/src-test/org/gvsig/fmap/geom/operation/writegml2/WriteGmlTest.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
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import java.io.ByteArrayOutputStream;
25
import java.io.IOException;
26
import java.io.OutputStream;
27

  
28
import org.slf4j.Logger;
29
import org.slf4j.LoggerFactory;
30

  
31
import org.gvsig.fmap.geom.Geometry;
32
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
33
import org.gvsig.fmap.geom.Geometry.TYPES;
34
import org.gvsig.fmap.geom.GeometryLocator;
35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.aggregate.MultiCurve;
37
import org.gvsig.fmap.geom.aggregate.MultiPoint;
38
import org.gvsig.fmap.geom.aggregate.MultiSurface;
39
import org.gvsig.fmap.geom.exception.CreateGeometryException;
40
import org.gvsig.fmap.geom.operation.GeometryOperationException;
41
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
42
import org.gvsig.fmap.geom.primitive.Curve;
43
import org.gvsig.fmap.geom.primitive.GeneralPathX;
44
import org.gvsig.fmap.geom.primitive.Point;
45
import org.gvsig.fmap.geom.primitive.Surface;
46
import org.gvsig.gpe.lib.api.GPELocator;
47
import org.gvsig.gpe.lib.api.GPEManager;
48
import org.gvsig.gpe.lib.api.exceptions.WriterHandlerCreationException;
49
import org.gvsig.gpe.lib.api.writer.IGPEWriterHandler;
50
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
51

  
52

  
53
/**
54
 * @author gvSIG Team
55
 * @version $Id$
56
 *
57
 */
58
public class WriteGmlTest extends AbstractLibraryAutoInitTestCase{
59
    private static final Logger LOG = LoggerFactory.getLogger(WriteGmlTest.class);
60
    private GeometryManager geometryManager;
61
    private GPEManager gpeManager;
62
    
63
    protected void doSetUp() throws Exception {
64
        geometryManager = GeometryLocator.getGeometryManager();   
65
        gpeManager = GPELocator.getGPEManager();
66
    }
67
    
68
    private String write(Geometry geometry) throws WriterHandlerCreationException, GeometryOperationNotSupportedException, GeometryOperationException{      
69
        OutputStream os = new ByteArrayOutputStream();   
70
        IGPEWriterHandler writerHandler = gpeManager.createWriterByMimeType("text/xml; subtype=gml/3.1.2");  
71
        writerHandler.setOutputStream(os);
72
        writerHandler.initialize(); 
73
               
74
        WriteGml2OperationContext operationContext = new WriteGml2OperationContext();
75
        operationContext.setWriterHandler(writerHandler);
76
        operationContext.setId("0");
77
        operationContext.setSrs("EPSG:23030");
78
        
79
        geometry.invokeOperation(WriteGml2Operation.NAME, operationContext);
80
   
81
        writerHandler.close();
82

  
83
        LOG.info("Parsed geometry: " + os.toString());
84
        assertTrue(os.toString().startsWith("<?xml"));
85
        return os.toString();
86
    }
87
    
88
    public void testPoint2D() throws CreateGeometryException, WriterHandlerCreationException, GeometryOperationNotSupportedException, GeometryOperationException, IOException{
89
        Point point = (Point)geometryManager.create(TYPES.POINT, SUBTYPES.GEOM2D);
90
        point.setCoordinateAt(0, 1.0);
91
        point.setCoordinateAt(1, 2.0);
92
        
93
        write(point);        
94
    }    
95
    
96
    public void testCurve2D() throws CreateGeometryException, WriterHandlerCreationException, GeometryOperationNotSupportedException, GeometryOperationException, IOException{
97
        Curve curve = (Curve)geometryManager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
98
        GeneralPathX generalPathX = new GeneralPathX();
99
        generalPathX.moveTo(0, 0);
100
        generalPathX.lineTo(1, 1);
101
        generalPathX.lineTo(2, 1);      
102
        curve.setGeneralPath(generalPathX); 
103
        
104
        write(curve);
105
    }  
106
    
107
    public void testSurface2D() throws CreateGeometryException, WriterHandlerCreationException, GeometryOperationNotSupportedException, GeometryOperationException, IOException{
108
        Surface surface = (Surface)geometryManager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);
109
        GeneralPathX generalPathX = new GeneralPathX();
110
        generalPathX.moveTo(0, 0);
111
        generalPathX.lineTo(1, 1);
112
        generalPathX.lineTo(2, 1);
113
        surface.setGeneralPath(generalPathX);   
114
        
115
        write(surface);
116
    } 
117
    
118
    public void testMultiPoint2D() throws CreateGeometryException, WriterHandlerCreationException, GeometryOperationNotSupportedException, GeometryOperationException, IOException{
119
        Point point1 = (Point)geometryManager.create(TYPES.POINT, SUBTYPES.GEOM3D);
120
        point1.setCoordinateAt(0, 1.0);
121
        point1.setCoordinateAt(1, 2.0);
122
        point1.setCoordinateAt(2, 3.0);
123
        
124
        Point point2 = (Point)geometryManager.create(TYPES.POINT, SUBTYPES.GEOM3D);
125
        point2.setCoordinateAt(0, 4.0);
126
        point2.setCoordinateAt(1, 5.0);
127
        point2.setCoordinateAt(2, 6.0);
128
        
129
        MultiPoint multiPoint = (MultiPoint)geometryManager.create(TYPES.MULTIPOINT, SUBTYPES.GEOM2D);
130
        multiPoint.addPoint(point1);
131
        multiPoint.addPoint(point2);
132
        
133
        write(multiPoint);        
134
    }    
135
    
136
    public void testMultiCurve2D() throws CreateGeometryException, WriterHandlerCreationException, GeometryOperationNotSupportedException, GeometryOperationException, IOException{
137
        Curve curve1 = (Curve)geometryManager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
138
        GeneralPathX generalPathX1 = new GeneralPathX();
139
        generalPathX1.moveTo(0, 0);
140
        generalPathX1.lineTo(1, 1);
141
        generalPathX1.lineTo(2, 1);     
142
        curve1.setGeneralPath(generalPathX1);   
143
        
144
        Curve curve2 = (Curve)geometryManager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
145
        GeneralPathX generalPathX2 = new GeneralPathX();
146
        generalPathX2.moveTo(0, 0);
147
        generalPathX2.lineTo(1, 1);
148
        generalPathX2.lineTo(2, 1);     
149
        curve2.setGeneralPath(generalPathX2);   
150
        
151
        MultiCurve multiCurve = (MultiCurve)geometryManager.create(TYPES.MULTICURVE, SUBTYPES.GEOM2D);
152
        multiCurve.addCurve(curve1);
153
        multiCurve.addCurve(curve2);
154
        
155
        write(multiCurve);
156
    }  
157
    
158
    public void testMultiSurface2D() throws CreateGeometryException, WriterHandlerCreationException, GeometryOperationNotSupportedException, GeometryOperationException, IOException{
159
        Surface surface1 = (Surface)geometryManager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);
160
        GeneralPathX generalPathX1 = new GeneralPathX();
161
        generalPathX1.moveTo(0, 0);
162
        generalPathX1.lineTo(1, 1);
163
        generalPathX1.lineTo(2, 1);     
164
        surface1.setGeneralPath(generalPathX1); 
165
        
166
        Surface surface2 = (Surface)geometryManager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);     
167
        GeneralPathX generalPathX2 = new GeneralPathX();
168
        generalPathX2.moveTo(0, 0);
169
        generalPathX2.lineTo(1, 1);
170
        generalPathX2.lineTo(2, 1);     
171
        surface2.setGeneralPath(generalPathX2); 
172
        
173
        MultiSurface multiSurface = (MultiSurface)geometryManager.create(TYPES.MULTISURFACE, SUBTYPES.GEOM2D);
174
        multiSurface.addSurface(surface1);
175
        multiSurface.addSurface(surface2); 
176
        
177
        write(multiSurface);
178
    } 
179
    
180
}
0 181

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/config/text.properties
1
gpe_preferences_window=Gml Persistence Engine
2
gpe_preferences_window_other=Otros
3
gpe_preferences_window_xmlschema=XML Schema
4
gpe_preferences_window_xml=XML
5
gpe_preferences_window_coordinates=Coordenadas
6
gpe_xmlVersion=Versi?n de XML
7
gpe_xmlEncoding=Codificaci?n
8
gpe_defaultBlancSpace=Espacio en blanco para la etiquetas
9
gpe_namespacePrefix=Prefijo del Namespace
10
gpe_namespaceURI=Namespace
11
gpe_schemaName=Nombre del esquema por defecto
12
gpe_coordinates=S?mbolo decimal
13
gpe_coordinatesSeparator=Separador entre coordenadas
14
gpe_tuplesSeparator=Separador entre pares de coordenadas
15
gpe_decimalDigits=N?mero de decimales
16
gpe_exporting=Exportando capa
17
gpe_select_version=Selecciona la versi?n 
18
gpe_select_format=Selecciona el formato
19
gpe_select_writer=Selecciona el writer
20
gpe_select_schema=Selecciona el XML schema
21
gpe_create_default_schema=Crear un esquema por defecto
22
gpe_select_file=Seleciona el fichero
23
gpe_select_writer_window=Exportar a fichero
24
gpe_gvsig_dont_support_multilayer=La actual versi?n de gvSIG no soporta multicapa.\ Todas las geometr\u00edas se cargar\u00e1n en la misma capa. 
0 25

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/config/text_en.properties
1
gpe_preferences_window=Gml Persistence Engine
2
gpe_preferences_window_other=Others
3
gpe_preferences_window_xmlschema=XML Schema
4
gpe_preferences_window_xml=XML
5
gpe_preferences_window_coordinates=Coordinates
6
gpe_xmlVersion=XML version
7
gpe_xmlEncoding=XML Encoding
8
gpe_defaultBlancSpace=Blank space for the label names
9
gpe_namespacePrefix=Namespace prefix
10
gpe_namespaceURI=Namespace
11
gpe_schemaName=Default namespace
12
gpe_coordinates=Decimal symbol
13
gpe_coordinatesSeparator=Separator between coordinates
14
gpe_tuplesSeparator=Separator between a pair of coordinates
15
gpe_decimalDigits=Decimal number
16
gpe_exporting=Exporting a layer
17
gpe_select_version=Select the version 
18
gpe_select_format=Select the format
19
gpe_select_writer=Select a writer
20
gpe_select_schema=Select a schema
21
gpe_create_default_schema=Create a default schema
22
gpe_select_file=Select the file
23
gpe_select_writer_window=Export to file
24
gpe_gvsig_dont_support_multilayer=Current gvSIG version doesnt support multilayer.\All the geometries have been loaded on the same layer.
0 25

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app" />
4
	<libraries library-dir="lib"/>
5
	<resourceBundle name="text"/>
6
	<extensions>		
7
		<extension class-name="org.gvsig.gpe.GPELibraryExtension"
8
			description=""
9
			active="true"
10
			priority="1">			
11
		</extension>
12
		<!-- 	
13
		<extension class-name="org.gvsig.gpe.GPEWriterExtension"
14
			description="Support for writing"
15
			active="true">
16
			<menu text="Capa/export_to/GML" action-command="GML"/>
17
			<menu text="Capa/export_to/KML" action-command="KML"/>
18
		</extension>
19
		<extension class-name="org.gvsig.gpe.AboutGPEExtension"
20
                description="Extension to add about panel."
21
                active="true"
22
                priority="1">
23
		</extension>
24
		-->    			
25
	</extensions>
26
</plugin-config>
0 27

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/src/org/gvsig/gpe/GPELibraryExtension.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
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.gpe;
29

  
30
import org.gvsig.andami.IconThemeHelper;
31
import org.gvsig.andami.plugins.Extension;
32
import org.gvsig.fmap.dal.store.gpe.GPEStoreProvider;
33
import org.gvsig.fmap.mapcontext.MapContextLocator;
34

  
35

  
36
/**
37
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
38
 */
39
public class GPELibraryExtension extends Extension{
40
		
41
	public void execute(String actionCommand) {
42
	}
43

  
44
	public void initialize() {
45
		IconThemeHelper.registerIcon("layer", "layer-icon-gpe", this);
46
	}	
47

  
48
	public void postInitialize() {
49
		MapContextLocator.getMapContextManager().registerIconLayer(GPEStoreProvider.NAME, "layer-icon-gpe");
50
	}
51

  
52
	public boolean isEnabled() {
53
		return false;
54
	}
55

  
56
	public boolean isVisible() {
57
		return false;
58
	}
59

  
60
}
61

  
0 62

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/GPEStoreProvider.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
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31
import java.util.Map;
32

  
33
import org.cresques.cts.IProjection;
34
import org.slf4j.Logger;
35
import org.slf4j.LoggerFactory;
36

  
37
import org.gvsig.fmap.dal.DALLocator;
38
import org.gvsig.fmap.dal.DataManager;
39
import org.gvsig.fmap.dal.DataServerExplorer;
40
import org.gvsig.fmap.dal.DataStore;
41
import org.gvsig.fmap.dal.DataStoreParameters;
42
import org.gvsig.fmap.dal.DataTypes;
43
import org.gvsig.fmap.dal.FileHelper;
44
import org.gvsig.fmap.dal.exception.DataException;
45
import org.gvsig.fmap.dal.exception.InitializeException;
46
import org.gvsig.fmap.dal.exception.OpenException;
47
import org.gvsig.fmap.dal.exception.ReadException;
48
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
49
import org.gvsig.fmap.dal.feature.FeatureQuery;
50
import org.gvsig.fmap.dal.feature.FeatureType;
51
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider;
52
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
53
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
54
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider;
55
import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
56
import org.gvsig.fmap.dal.resource.file.FileResource;
57
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
58
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
59
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
60
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
61
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
62
import org.gvsig.fmap.dal.store.gpe.handlers.FmapContentHandler;
63
import org.gvsig.fmap.dal.store.gpe.handlers.FmapErrorHandler;
64
import org.gvsig.fmap.geom.Geometry.TYPES;
65
import org.gvsig.fmap.geom.primitive.Envelope;
66
import org.gvsig.gpe.lib.api.GPELocator;
67
import org.gvsig.gpe.lib.api.GPEManager;
68
import org.gvsig.tools.dynobject.DynObject;
69
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
70
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator;
71
import org.gvsig.xmlschema.lib.api.XMLSchemaManager;
72

  
73
/**
74
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
75
 */
76
public class GPEStoreProvider extends AbstractFeatureStoreProvider implements
77
ResourceConsumer {
78
    public static final String NAME = "GPE";
79
    public static final String DESCRIPTION = "GPE file";
80
    public static final String METADATA_DEFINITION_NAME = NAME;
81
    
82
    private static Logger logger = LoggerFactory.getLogger(GPEStoreProvider.class);
83

  
84
    protected File m_Fich;
85
    protected boolean isOpen = false;
86
    //private GPEStoreParameters gpeParams;
87
    private ResourceProvider gpeResource;
88

  
89
    //Managers to manage the parsing process
90
    protected GPEManager gpeManager = null;
91
    protected XMLSchemaManager xmlSchemaManager = null;
92

  
93
    //The content handler and the error handler
94
    protected FmapContentHandler contentHandler;
95
    protected FmapErrorHandler errorHandler;
96

  
97
    public GPEStoreProvider(DataStoreParameters params,
98
        DataStoreProviderServices storeServices)
99
    throws InitializeException {
100
        this(params, storeServices, FileHelper
101
            .newMetadataContainer(METADATA_DEFINITION_NAME));
102
    }   
103

  
104
    protected GPEStoreProvider(DataStoreParameters params,
105
        DataStoreProviderServices storeServices, DynObject metadata)
106
    throws InitializeException {
107

  
108
        super(params, storeServices, metadata);
109

  
110
        this.setDynValue("Envelope", params.getDynValue("Envelope"));
111

  
112
        gpeManager = GPELocator.getGPEManager();
113
        xmlSchemaManager = XMLSchemaLocator.getXMLSchemaManager();		
114

  
115
        retrieveFile();
116
        gpeResource = this.createResource(FileResource.NAME,
117
            new Object[] { m_Fich.getAbsolutePath() });
118
        gpeResource.addConsumer(this);
119
        this.initFeatureType();
120
    }
121

  
122
    protected void retrieveFile() throws InitializeException{
123
        m_Fich = getGPEParameters().getFile();
124
    }
125

  
126
    protected void initFeatureType() throws InitializeException {
127
        try {
128

  
129
            this.open();
130
        } catch (DataException e) {
131
            throw new InitializeException(this.getProviderName(), e);
132
        }
133
    }
134

  
135
    private GPEStoreParameters getGPEParameters() {
136
        return (GPEStoreParameters) this.getParameters();
137
    }
138

  
139
    public Object getDynValue(String name) throws DynFieldNotFoundException {
140
        if (DataStore.METADATA_CRS.equalsIgnoreCase(name)) {
141
            IProjection resp = this.getSRS();
142
            if (resp != null) {
143
                return resp;
144
            }
145
        }
146
        return super.getDynValue(name);
147
    }
148
    
149
    /* (non-Javadoc)
150
     * @see org.gvsig.fmap.dal.resource.spi.ResourceConsumer#closeResourceRequested(org.gvsig.fmap.dal.resource.spi.ResourceProvider)
151
     */
152
    public boolean closeResourceRequested(ResourceProvider resource) {
153
        // TODO Auto-generated method stub
154
        return false;
155
    }
156

  
157
    /* (non-Javadoc)
158
     * @see org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.gvsig.fmap.dal.resource.spi.ResourceProvider)
159
     */
160
    public void resourceChanged(ResourceProvider resource) {
161
        // TODO Auto-generated method stub
162

  
163
    }
164

  
165
    /* (non-Javadoc)
166
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#canWriteGeometry(int)
167
     */
168
    public boolean canWriteGeometry(int geometryType, int geometrySubtype)
169
    throws DataException {
170
        // TODO Auto-generated method stub
171
        return false;
172
    }
173

  
174
    /* (non-Javadoc)
175
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createNewOID()
176
     */
177
    public Object createNewOID() {
178
        return contentHandler.createNewOID();
179
    }
180

  
181
    /* (non-Javadoc)
182
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createSet(org.gvsig.fmap.dal.feature.FeatureQuery)
183
     */
184
    public FeatureSetProvider createSet(FeatureQuery query)
185
    throws DataException {
186
        return new GPESetProvider(this, query);
187
    }
188

  
189
    protected FeatureProvider internalGetFeatureProviderByReference(
190
        FeatureReferenceProviderServices reference) throws DataException {
191
        return internalGetFeatureProviderByReference(reference,
192
            this
193
            .getFeatureStore()
194
            .getDefaultFeatureType());
195
    }
196

  
197
    public FeatureProvider internalGetFeatureProviderByReference(
198
        FeatureReferenceProviderServices reference, FeatureType featureType)
199
    throws DataException {
200
        Map featureSet = contentHandler.getFeatureSet();
201
        if (featureSet.containsKey(reference.getOID())){
202
            return (FeatureProvider)featureSet.get(reference.getOID());
203
        }
204
        return null;
205
    }
206

  
207
    FeatureProvider getFeatureProviderByIndex(Long index, FeatureType fType)
208
    throws DataException {
209
        Map featureSet = contentHandler.getFeatureSet();
210
        if (featureSet.containsKey(index)){
211
            return (FeatureProvider)featureSet.get(index);
212
        }        
213
        return null;
214
    }
215

  
216
    public void resourcesBegin() throws ResourceExecuteException {
217
        // Nothing to do
218
    }
219

  
220
    public void resourcesEnd() {
221
        // Nothing to do
222
    }
223

  
224
    /* (non-Javadoc)
225
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getFeatureReferenceOIDType()
226
     */
227
    public int getOIDType() {
228
        return DataTypes.STRING;
229
    }
230

  
231
    /* (non-Javadoc)
232
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getName()
233
     */
234
    public String getProviderName() {
235
        return NAME;
236
    }
237

  
238
    /* (non-Javadoc)
239
     * @see org.gvsig.fmap.dal.spi.DataStoreProvider#getSourceId()
240
     */
241
    public Object getSourceId() {
242
        return getGPEParameters().getFile();
243
    }
244

  
245
    public String getName() {
246
        String name = this.getGPEParameters().getFile().getName();
247
        int n = name.lastIndexOf(".");
248
        if( n<1 ) {
249
            return name;
250
        }
251
        return name.substring(0, n);
252
    }
253

  
254
    public String getFullName() {
255
        return this.getGPEParameters().getFile().getAbsolutePath();
256
    }
257

  
258
    /* (non-Javadoc)
259
     * @see org.gvsig.fmap.dal.spi.DataStoreProvider#open()
260
     */
261
    public void open() throws OpenException {
262
        if (isOpen) {
263
            return;
264
        }
265
        try {
266
            errorHandler = new FmapErrorHandler();
267
            contentHandler = new FmapContentHandler(errorHandler,
268
                getStoreServices(), this, m_Fich,
269
                getSRS(),
270
                getGeometryType());
271
            if (getStoreServices().getDefaultFeatureType() != null){
272
                contentHandler.setFeatureType(getStoreServices().getDefaultFeatureType().getEditable());
273
            }
274
            contentHandler.setEnvelope((Envelope)getDynValue("Envelope"));
275
            isOpen = true;
276
            gpeManager.parse(contentHandler, errorHandler, m_Fich.toURI());			
277
        } catch (Exception e) {
278
            throw new OpenException("Imposible create a parser",e);
279
        }
280
    }
281

  
282
    protected IProjection getSRS(){
283
        return getGPEParameters().getCRS();
284
    }	
285

  
286
    protected int getGeometryType() {
287
        return TYPES.GEOMETRY;
288
    }
289

  
290
    /* (non-Javadoc)
291
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createSet(org.gvsig.fmap.dal.feature.FeatureQuery, org.gvsig.fmap.dal.feature.FeatureType)
292
     */
293
    public FeatureSetProvider createSet(FeatureQuery query,
294
        FeatureType featureType) throws DataException {
295
        return new GPESetProvider(this, query, featureType);
296
    }
297

  
298
    public long getFeatureCount() throws DataException {		
299
        return contentHandler.getFeaturesCount();
300
    }
301

  
302
    /* (non-Javadoc)
303
     * @see org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider#getEnvelope()
304
     */
305
    public Envelope getEnvelope() throws DataException {
306
        this.open();
307
        return (Envelope) this.getDynValue("Envelope");
308
    }
309

  
310
    public void setEnvelope(Envelope envelope) {
311
        this.setDynValue("Envelope", envelope);
312
    }
313

  
314
    public ResourceProvider getResource() {
315
        return gpeResource;
316
    }
317

  
318
    public DataServerExplorer getExplorer() throws ReadException,
319
    ValidateDataParametersException {
320
        DataManager manager = DALLocator.getDataManager();
321
        FilesystemServerExplorerParameters params;
322
        try {
323
            params = (FilesystemServerExplorerParameters) manager
324
            .createServerExplorerParameters(FilesystemServerExplorer.NAME);
325
            params.setRoot(this.getGPEParameters().getFile().getParent());
326
            return manager.createServerExplorer(params);
327
        } catch (DataException e) {
328
            throw new ReadException(this.getProviderName(), e);
329
        } catch (ValidateDataParametersException e) {
330
            // TODO Auto-generated catch block
331
            throw new ReadException(this.getProviderName(), e);
332
        }
333
    }
334

  
335
    /**
336
     * @return the contentHandler
337
     */
338
    public FmapContentHandler getContentHandler() {
339
        return contentHandler;
340
    }
341

  
342
    /**
343
     * @return the errorHandler
344
     */
345
    public FmapErrorHandler getErrorHandler() {
346
        return errorHandler;
347
    }
348

  
349
}
0 350

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/GPEStoreParameters.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
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31

  
32
import org.cresques.cts.IProjection;
33
import org.gvsig.fmap.dal.DataStoreParameters;
34
import org.gvsig.fmap.dal.FileHelper;
35
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
36
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
37
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
38
import org.gvsig.fmap.geom.primitive.Envelope;
39
import org.gvsig.tools.dynobject.DelegatedDynObject;
40
import org.gvsig.tools.dynobject.DynStruct;
41

  
42
/**
43
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
44
 */
45
public class GPEStoreParameters extends AbstractDataParameters implements
46
DataStoreParameters, FilesystemStoreParameters {
47

  
48
    public static final String PARAMETERS_DEFINITION_NAME = "GPEStoreParameters";
49

  
50
    private static final String FILE_PARAMETER_NAME = "File";
51
    private static final String CRS_PARAMETER_NAME = "CRS";
52
    private static final String ENVELOPE_PARAMETER_NAME = "Envelope";
53

  
54
    private DelegatedDynObject parameters;
55

  
56
    public GPEStoreParameters() {
57
        this(PARAMETERS_DEFINITION_NAME);
58
    }
59

  
60
    protected GPEStoreParameters(String parametersDefinitionName) {
61
        this(parametersDefinitionName, GPEStoreProvider.NAME);
62
    }
63

  
64
    public GPEStoreParameters(String parametersDefinitionName, String name) {
65
        super();
66
        this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
67
        this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);       
68
    }
69

  
70
    protected static void registerParametersDefinition(){ 
71
        DynStruct dynStruct = FileHelper.registerParametersDefinition(
72
            GPEStoreParameters.PARAMETERS_DEFINITION_NAME,
73
            GPEStoreParameters.class, "GPEParameters.xml");
74
        dynStruct.addDynFieldObject("Envelope").setClassOfValue(Envelope.class).setMandatory(false);
75
    }
76

  
77
    protected DelegatedDynObject getDelegatedDynObject() {
78
        return parameters;
79
    }
80

  
81
    public String getDataStoreName() {
82
        return GPEStoreProvider.NAME;
83
    }
84

  
85
    public String getDescription() {
86
        return GPEStoreProvider.DESCRIPTION;
87
    }
88

  
89
    public boolean isValid() {
90
        return (this.getFile() != null);
91
    }
92

  
93
    public File getFile() {
94
        return (File) this.getDynValue(FILE_PARAMETER_NAME);
95
    }
96

  
97
    public void setFile(File file) {
98
        this.setDynValue(FILE_PARAMETER_NAME, file);
99
    }	
100

  
101
    public String getFileName() {
102
        return this.getFile().getAbsolutePath();
103
    }
104

  
105
    public void setFileName(String fileName) {
106
        this.setDynValue(FILE_PARAMETER_NAME, fileName);
107
    }
108

  
109
    public IProjection getCRS() {
110
        return (IProjection) this.getDynValue(CRS_PARAMETER_NAME);
111
    }
112

  
113
    public void setCRS(IProjection srs) {
114
        this.setDynValue(CRS_PARAMETER_NAME, srs);
115
    }
116

  
117
    public void setCRS(String srs) {
118
        this.setDynValue(CRS_PARAMETER_NAME, srs);
119
    }
120

  
121
    public Envelope getEnvelope() {
122
        return (Envelope) this.getDynValue(ENVELOPE_PARAMETER_NAME);
123
    }
124

  
125
    public void setEnvelope(Envelope envelope) {
126
        this.setDynValue(ENVELOPE_PARAMETER_NAME, envelope);
127
    }
128
}
0 129

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/handlers/FmapErrorHandler.java
1
package org.gvsig.fmap.dal.store.gpe.handlers;
2

  
3
import org.gvsig.gpe.lib.impl.parser.GPEErrorHandler;
4

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

  
56
}
0 57

  
tags/v2_0_0_Build_2058/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/handlers/FmapContentHandler.java
1
package org.gvsig.fmap.dal.store.gpe.handlers;
2

  
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.ArrayList;
6
import java.util.HashMap;
7
import java.util.Iterator;
8
import java.util.List;
9
import java.util.Map;
10

  
11
import org.cresques.cts.IProjection;
12
import org.gvsig.fmap.dal.DataTypes;
13
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
14
import org.gvsig.fmap.dal.feature.EditableFeatureType;
15
import org.gvsig.fmap.dal.feature.Feature;
16
import org.gvsig.fmap.dal.feature.FeatureType;
17
import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
18
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
19
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
20
import org.gvsig.fmap.dal.store.gpe.GPEStoreProvider;
21
import org.gvsig.fmap.dal.store.gpe.model.GPEElement;
22
import org.gvsig.fmap.dal.store.gpe.model.GPEFeature;
23
import org.gvsig.fmap.geom.Geometry;
24
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
25
import org.gvsig.fmap.geom.Geometry.TYPES;
26
import org.gvsig.fmap.geom.GeometryLocator;
27
import org.gvsig.fmap.geom.GeometryManager;
28
import org.gvsig.fmap.geom.aggregate.MultiCurve;
29
import org.gvsig.fmap.geom.aggregate.MultiPoint;
30
import org.gvsig.fmap.geom.aggregate.MultiPrimitive;
31
import org.gvsig.fmap.geom.aggregate.MultiSurface;
32
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
33
import org.gvsig.fmap.geom.exception.CreateGeometryException;
34
import org.gvsig.fmap.geom.primitive.Curve;
35
import org.gvsig.fmap.geom.primitive.Envelope;
36
import org.gvsig.fmap.geom.primitive.GeneralPathX;
37
import org.gvsig.fmap.geom.primitive.Point;
38
import org.gvsig.fmap.geom.primitive.Primitive;
39
import org.gvsig.fmap.geom.primitive.Surface;
40
import org.gvsig.gpe.lib.api.parser.IAttributesIterator;
41
import org.gvsig.gpe.lib.api.parser.ICoordinateIterator;
42
import org.gvsig.gpe.lib.api.parser.IGPEErrorHandler;
43
import org.gvsig.gpe.lib.impl.parser.GPEContentHandler;
44
import org.jfree.util.Log;
45
import org.slf4j.Logger;
46
import org.slf4j.LoggerFactory;
47
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
48
 *
49
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
50
 *
51
 * This program is free software; you can redistribute it and/or
52
 * modify it under the terms of the GNU General Public License
53
 * as published by the Free Software Foundation; either version 2
54
 * of the License, or (at your option) any later version.
55
 *
56
 * This program is distributed in the hope that it will be useful,
57
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
58
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
59
 * GNU General Public License for more details.
60
 *
61
 * You should have received a copy of the GNU General Public License
62
 * along with this program; if not, write to the Free Software
63
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
64
 *
65
 * For more information, contact:
66
 *
67
 *  Generalitat Valenciana
68
 *   Conselleria d'Infraestructures i Transport
69
 *   Av. Blasco Ib??ez, 50
70
 *   46010 VALENCIA
71
 *   SPAIN
72
 *
73
 *      +34 963862235
74
 *   gvsig@gva.es
75
 *      www.gvsig.gva.es
76
 *
77
 *    or
78
 *
79
 *   IVER T.I. S.A
80
 *   Salamanca 50
81
 *   46005 Valencia
82
 *   Spain
83
 *
84
 *   +34 963163400
85
 *   dac@iver.es
86
 */
87
/* CVS MESSAGES:
88
 *
89
 * $Id$
90
 * $Log$
91
 *
92
 */
93
/**
94
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
95
 */
96
public class FmapContentHandler extends GPEContentHandler {
97
    private static final Logger LOG = LoggerFactory.getLogger(FmapContentHandler.class);
98

  
99
    private HashMap featureSet = null;
100
    private EditableFeatureType featureType = null;
101
    private FeatureStoreProviderServices store = null;
102
    private GPEStoreProvider storeProvider = null;
103
    private GeometryManager geomManager = GeometryLocator.getGeometryManager();
104
    private int featureId = 0;
105
    private Envelope envelope = null;
106
    private File file = null;
107
    private IProjection srs = null;
108
    private int geometryType = 0;
109

  
110
    public FmapContentHandler(IGPEErrorHandler errorHandler, FeatureStoreProviderServices store,
111
        GPEStoreProvider storeProvider, File file, IProjection srs, int geometryType) {
112
        super();
113
        setErrorHandler(errorHandler);
114
        this.store = store;
115
        this.storeProvider = storeProvider;
116
        this.file = file;
117
        this.srs = srs;
118
        this.geometryType = geometryType;
119
    }
120

  
121
    public int getFeaturesCount(){
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff