Revision 35404

View differences:

tags/v2_0_0_Build_2027/extGPE-gvSIG/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Thu Jun 02 13:18:09 CEST 2011
3
buildNumber=2027
tags/v2_0_0_Build_2027/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_2027/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_2027/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_2027/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_2027/extGPE-gvSIG/config/about.htm
1
<html>
2
  <head>
3
    <title>libGPE Extension.</title>
4
    <meta content="">
5
    <style></style>
6
  </head>
7
  <body>
8
<table width="60%" border="0">
9
  <tr>
10
     <td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td>
11
    <td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td>
12
  </tr>
13
  <tr>
14
    <td colspan="2"><font face="Arial, Helvetica, sans-serif">&copy; Copyright
15
      Generalitat Valenciana, IVER T.I. 2008.</font></td>
16
  </tr>
17
</table>
18
  <h3>libGPE Extension.</h3>
19
  <p><br><br><b> Build Number: #build.number#</b></p>
20
  </body>
21
</html>
0 22

  
tags/v2_0_0_Build_2027/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_2027/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_2027/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/DALGPELibrary.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.util.ArrayList;
31
import java.util.List;
32

  
33
import org.gvsig.fmap.dal.DALFileLibrary;
34
import org.gvsig.fmap.dal.DALFileLocator;
35
import org.gvsig.fmap.dal.DALLibrary;
36
import org.gvsig.fmap.dal.DALLocator;
37
import org.gvsig.fmap.dal.DataTypes;
38
import org.gvsig.fmap.dal.FileHelper;
39
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
40
import org.gvsig.fmap.geom.Geometry;
41
import org.gvsig.fmap.geom.GeometryLocator;
42
import org.gvsig.fmap.geom.GeometryManager;
43
import org.gvsig.fmap.geom.operation.writegml2.CurveWriteGml2Operation;
44
import org.gvsig.fmap.geom.operation.writegml2.MultiCurveWriteGml2Operation;
45
import org.gvsig.fmap.geom.operation.writegml2.MultiPointWriteGml2Operation;
46
import org.gvsig.fmap.geom.operation.writegml2.MultiSurfaceWriteGml2Operation;
47
import org.gvsig.fmap.geom.operation.writegml2.PointWriteGml2Operation;
48
import org.gvsig.fmap.geom.operation.writegml2.SurfaceWriteGml2Operation;
49
import org.gvsig.fmap.geom.operation.writegml2.WriteGml2Operation;
50
import org.gvsig.metadata.exceptions.MetadataException;
51
import org.gvsig.tools.library.AbstractLibrary;
52
import org.gvsig.tools.library.LibraryException;
53
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
54
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator;
55
import org.gvsig.xmlschema.lib.api.XMLSchemaManager;
56

  
57
/**
58
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
59
 */
60
public class DALGPELibrary extends AbstractLibrary {
61
	
62
    @Override
63
    public void doRegistration() {
64
        registerAsServiceOf(DALLibrary.class);
65
        require(DALFileLibrary.class);
66
    }
67

  
68
	protected void doInitialize() throws LibraryException {
69
		// Do nothing
70
	}
71

  
72
	protected void doPostInitialize() throws LibraryException {
73

  
74
		List exs = new ArrayList();
75

  
76
		GPEStoreParameters.registerParametersDefinition();
77
		
78
		try {
79
			FileHelper.registerMetadataDefinition(
80
					GPEStoreProvider.METADATA_DEFINITION_NAME,
81
					GPEStoreProvider.class, "GPEMetadata.xml");
82
		} catch (MetadataException e) {
83
			exs.add(e);
84
		}
85

  
86

  
87
		DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
88
		.getDataManager();
89

  
90
		if (!dataman.getStoreProviders().contains(GPEStoreProvider.NAME)) {
91
			dataman.registerStoreProvider(GPEStoreProvider.NAME,
92
					GPEStoreProvider.class, GPEStoreParameters.class);
93
		}
94

  
95
		DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
96
				GPEStoreProvider.NAME, GPEStoreProvider.DESCRIPTION,
97
				GPEFileSystemServerProvider.class);
98
		
99
		// Validate there is any implementation registered.
100
		XMLSchemaManager xmlSchemaManager = XMLSchemaLocator.getXMLSchemaManager();
101
		if (xmlSchemaManager == null) {
102
			exs.add(new ReferenceNotRegisteredException(
103
					XMLSchemaLocator.XMLSCHEMA_MANAGER_NAME, XMLSchemaLocator
104
							.getInstance()));
105
		}
106
		
107
		//Register the application types in gpe. GPE uses the DAL types like internal types
108
		xmlSchemaManager.registerAppDataType(DataTypes.UNKNOWN, DataTypes.UNKNOWN);
109
		xmlSchemaManager.registerAppDataType(DataTypes.BOOLEAN, DataTypes.BOOLEAN);
110
		xmlSchemaManager.registerAppDataType(DataTypes.BYTE, DataTypes.BYTE);
111
		xmlSchemaManager.registerAppDataType(DataTypes.CHAR, DataTypes.CHAR);
112
		xmlSchemaManager.registerAppDataType(DataTypes.INT, DataTypes.INT);
113
		xmlSchemaManager.registerAppDataType(DataTypes.LONG, DataTypes.LONG);
114
		xmlSchemaManager.registerAppDataType(DataTypes.FLOAT, DataTypes.FLOAT);
115
		xmlSchemaManager.registerAppDataType(DataTypes.DOUBLE, DataTypes.DOUBLE);
116
		xmlSchemaManager.registerAppDataType(DataTypes.STRING, DataTypes.STRING);
117
		xmlSchemaManager.registerAppDataType(DataTypes.DATE, DataTypes.DATE);
118
		xmlSchemaManager.registerAppDataType(DataTypes.TIME, DataTypes.TIME);
119
		xmlSchemaManager.registerAppDataType(DataTypes.TIMESTAMP, DataTypes.TIMESTAMP);
120
		xmlSchemaManager.registerAppDataType(DataTypes.GEOMETRY, DataTypes.GEOMETRY);
121
		xmlSchemaManager.registerAppDataType(DataTypes.OBJECT, DataTypes.OBJECT);
122
		xmlSchemaManager.registerAppDataType(DataTypes.DYNOBJECT, DataTypes.DYNOBJECT);
123
		xmlSchemaManager.registerAppDataType(DataTypes.CRS, DataTypes.CRS);		
124
		xmlSchemaManager.registerAppDataType(DataTypes.FILE, DataTypes.FILE);
125
		xmlSchemaManager.registerAppDataType(DataTypes.BYTEARRAY, DataTypes.BYTEARRAY);
126
		
127
		//Mapping between GPE types and the application types
128
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.GEOMETRY, XMLSchemaManager.GEOMETRY);
129
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.POINT, XMLSchemaManager.POINT);
130
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.CURVE, XMLSchemaManager.LINESTRING);
131
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.SURFACE, XMLSchemaManager.POLYGON);
132
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.SOLID, XMLSchemaManager.SOLID);
133
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.AGGREGATE, XMLSchemaManager.MULTIGEOMETRY);
134
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTIPOINT, XMLSchemaManager.MULTIPOINT);
135
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTICURVE, XMLSchemaManager.MULTILINESTRING);
136
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTISURFACE, XMLSchemaManager.MULTIPOLYGON);
137
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTISOLID, XMLSchemaManager.MULTISOLID);
138
	      
139
        //Operations
140
		GeometryManager geometryManager = GeometryLocator.getGeometryManager();        
141
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new PointWriteGml2Operation(), Geometry.TYPES.POINT);
142
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new CurveWriteGml2Operation(), Geometry.TYPES.CURVE);
143
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new SurfaceWriteGml2Operation(), Geometry.TYPES.SURFACE);
144
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new MultiPointWriteGml2Operation(), Geometry.TYPES.MULTIPOINT);
145
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new MultiCurveWriteGml2Operation(), Geometry.TYPES.MULTICURVE);
146
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new MultiSurfaceWriteGml2Operation(), Geometry.TYPES.MULTISURFACE);
147
        
148
		if (exs.size() > 0) {
149
			throw new LibraryException(this.getClass(), exs);
150
		}
151
	}
152

  
153
}
154

  
155

  
0 156

  
tags/v2_0_0_Build_2027/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/exceptions/GPELayerException.java
1
package org.gvsig.fmap.dal.store.gpe.exceptions;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7
import org.gvsig.tools.exception.BaseException;
8

  
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id$
52
 * $Log$
53
 *
54
 */
55
/**
56
 * Thrown when there is an unknown problem loading 
57
 * a GPE layer
58
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
59
 */
60
public class GPELayerException extends BaseException {
61
	private static final long serialVersionUID = -5810461892751191682L;
62
	private FLayer layer = null;
63
	
64
	public GPELayerException(FLayer layer, Throwable exception) {
65
		this.layer = layer;
66
		initialize();
67
		initCause(exception);
68
	}
69
	
70
	/**
71
	 * Initialize the properties
72
	 */
73
	private void initialize() {
74
		messageKey = "gpe_gvsig_load_layer_error";
75
		formatString = "Error loading the layer " +
76
				"%(layerName).";
77
	}
78
	
79
	/*
80
	 *  (non-Javadoc)
81
	 * @see org.gvsig.exceptions.BaseException#values()
82
	 */
83
	protected Map values() {
84
		HashMap params = new HashMap();
85
		params.put("layerName", layer.getName());
86
		return params;	
87
	}
88
	
89
}
0 90

  
tags/v2_0_0_Build_2027/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/exceptions/NotExtentException.java
1
package org.gvsig.fmap.dal.store.gpe.exceptions;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7
import org.gvsig.tools.exception.BaseException;
8

  
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id$
52
 * $Log$
53
 *
54
 */
55
/**
56
 * This exception is thrown when it is not possible
57
 * to calculate an extent for a layer  
58
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
59
 */
60
public class NotExtentException extends BaseException {
61
	private static final long serialVersionUID = 620553176638259949L;
62
	private FLayer layer = null;
63
	
64
	public NotExtentException(FLayer layer, Throwable exception) {
65
		this.layer = layer;
66
		initialize();
67
		initCause(exception);
68
	}
69
	
70
	/**
71
	 * Initialize the properties
72
	 */
73
	private void initialize() {
74
		messageKey = "gpe_calculate_extent_error";
75
		formatString = "Error calculating the extent " +
76
				"for the layer %(layerName).";
77
	}
78
	
79
	/*
80
	 *  (non-Javadoc)
81
	 * @see org.gvsig.exceptions.BaseException#values()
82
	 */
83
	protected Map values() {
84
		HashMap params = new HashMap();
85
		params.put("layerName", layer.getName());
86
		return params;	
87
	}
88
	
89
}
0 90

  
tags/v2_0_0_Build_2027/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/exceptions/NotMultipleLayerWarning.java
1
package org.gvsig.fmap.dal.store.gpe.exceptions;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import org.gvsig.tools.exception.BaseException;
7

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

  
60
	public NotMultipleLayerWarning() {		
61
		initialize();		
62
	}
63
	
64
	/**
65
	 * Initialize the properties
66
	 */
67
	private void initialize() {
68
		messageKey = "gpe_not_multiple_layer_warning";
69
		formatString = "This gvSIG version doesn't support " +
70
			"muliple layers.";
71
	}
72
	
73
	/*
74
	 *  (non-Javadoc)
75
	 * @see org.gvsig.exceptions.BaseException#values()
76
	 */
77
	protected Map values() {
78
		HashMap params = new HashMap();
79
		return params;	
80
	}
81
}
82
	
0 83

  
tags/v2_0_0_Build_2027/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/GPEFileSystemServerProvider.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.dal.DALLocator;
33
import org.gvsig.fmap.dal.DataServerExplorer;
34
import org.gvsig.fmap.dal.DataStoreParameters;
35
import org.gvsig.fmap.dal.NewDataStoreParameters;
36
import org.gvsig.fmap.dal.exception.CreateException;
37
import org.gvsig.fmap.dal.exception.DataException;
38
import org.gvsig.fmap.dal.exception.RemoveException;
39
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
40
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
41
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
42
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
43
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
44
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
45
import org.gvsig.gpe.lib.api.GPELocator;
46
import org.gvsig.gpe.lib.api.GPEManager;
47

  
48
/**
49
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
50
 */
51
public class GPEFileSystemServerProvider extends AbstractFilesystemServerExplorerProvider 
52
	implements FilesystemServerExplorerProvider, ResourceConsumer {
53
	protected FilesystemServerExplorerProviderServices serverExplorer;
54

  
55
	private static final GPEManager GPE_MANAGER = GPELocator.getGPEManager();
56
	
57
	public boolean canCreate() {
58
		// TODO Auto-generated method stub
59
		return false;
60
	}
61
	
62
	public int getMode() {
63
		return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY;
64
	}
65

  
66
	public boolean canCreate(NewDataStoreParameters parameters) {
67
		return false;
68
	}
69

  
70
	public void create(NewDataStoreParameters parameters, boolean overwrite)
71
	throws CreateException {
72
		// TODO Auto-generated method stub
73

  
74
	}
75

  
76
	public NewDataStoreParameters getCreateParameters() throws DataException {
77
		return (NewFeatureStoreParameters) DALLocator.getDataManager()
78
		.createStoreParameters(this.getDataStoreProviderName());
79
	}
80

  
81
	public void initialize(
82
			FilesystemServerExplorerProviderServices serverExplorer) {
83
		this.serverExplorer = serverExplorer;		
84
	}
85

  
86
	public void remove(DataStoreParameters parameters) throws RemoveException {
87
		// TODO Auto-generated method stub
88

  
89
	}
90

  
91
	public String getDataStoreProviderName() {
92
		return GPEStoreProvider.NAME;
93
	}
94

  
95
	public String getDescription() {
96
		return GPEStoreProvider.DESCRIPTION;
97
	}
98

  
99
	public boolean accept(File pathName) {
100
	    return GPE_MANAGER.accept(pathName.toURI());	   
101
	}
102

  
103
	public boolean closeResourceRequested(ResourceProvider resource) {
104
		// TODO Auto-generated method stub
105
		return false;
106
	}
107

  
108
	public void resourceChanged(ResourceProvider resource) {
109
		// TODO Auto-generated method stub
110

  
111
	}
112

  
113
}
114

  
0 115

  
tags/v2_0_0_Build_2027/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/GPESetProvider.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.util.HashMap;
31
import java.util.Iterator;
32

  
33
import org.gvsig.fmap.dal.exception.DataException;
34
import org.gvsig.fmap.dal.feature.FeatureQuery;
35
import org.gvsig.fmap.dal.feature.FeatureType;
36
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureProviderIterator;
37
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureSetProvider;
38
import org.gvsig.tools.exception.BaseException;
39

  
40
/**
41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
42
 */
43
public class GPESetProvider extends AbstractFeatureSetProvider {
44

  
45
	public GPESetProvider(GPEStoreProvider store,
46
			FeatureQuery query) {
47
		super(store, query, null);
48
	}
49

  
50
	public GPESetProvider(GPEStoreProvider store,
51
			FeatureQuery query, FeatureType featureType) {
52
		super(store, query, featureType);
53
	}
54

  
55
	/* (non-Javadoc)
56
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#canFilter()
57
	 */
58
	public boolean canFilter() {
59
		// TODO Auto-generated method stub
60
		return false;
61
	}
62

  
63
	/* (non-Javadoc)
64
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#canIterateFromIndex()
65
	 */
66
	public boolean canIterateFromIndex() {
67
		// TODO Auto-generated method stub
68
		return false;
69
	}
70

  
71
	/* (non-Javadoc)
72
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#canOrder()
73
	 */
74
	public boolean canOrder() {
75
		// TODO Auto-generated method stub
76
		return false;
77
	}
78

  
79
	/* (non-Javadoc)
80
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#getSize()
81
	 */
82
	public long getSize() throws DataException {
83
		return getStore().getFeatureCount();
84
	}
85

  
86
	/* (non-Javadoc)
87
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#isEmpty()
88
	 */
89
	public boolean isEmpty() throws DataException {
90
		// TODO Auto-generated method stub
91
		return false;
92
	}
93

  
94
	protected AbstractFeatureProviderIterator createFastIterator(long index)
95
			throws DataException {
96
		return new GPEFastIterator((GPEStoreProvider) getStore(),
97
				getFeatureType());
98
	}
99

  
100
	protected AbstractFeatureProviderIterator createIterator(long index)
101
			throws DataException {
102
		return new GPEIterator((GPEStoreProvider) getStore(), getFeatureType());
103
	}
104

  
105
	protected class GPEIterator extends AbstractFeatureProviderIterator {
106
		protected FeatureType type;
107
		Iterator keys = null;
108
		HashMap features = null;
109

  
110
		public GPEIterator(GPEStoreProvider store, FeatureType type)
111
				throws DataException {
112
			super(store);
113
			this.type = type;
114
			features = store.getContentHandler().getFeatureSet();
115
			keys = features.keySet().iterator();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff