Revision 37630

View differences:

tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Thu Jan 12 18:41:55 CET 2012
3
buildNumber=2043
tags/v_2_0_0_Build_2043/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/v_2_0_0_Build_2043/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/v_2_0_0_Build_2043/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/v_2_0_0_Build_2043/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/v_2_0_0_Build_2043/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/v_2_0_0_Build_2043/extensions/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/v_2_0_0_Build_2043/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/v_2_0_0_Build_2043/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.plugins.Extension;
31

  
32

  
33
/**
34
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
35
 */
36
public class GPELibraryExtension extends Extension{
37
//	private DALGPELibrary lib = null;
38
		
39
	/* (non-Javadoc)
40
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
41
	 */
42
	public void execute(String actionCommand) {
43
		// TODO Auto-generated method stub
44
		
45
	}
46

  
47
	/* (non-Javadoc)
48
	 * @see com.iver.andami.plugins.IExtension#initialize()
49
	 */
50
	public void initialize() {
51
//		lib = new DALGPELibrary();
52
//		lib.initialize();		
53
	}	
54

  
55
	/* (non-Javadoc)
56
	 * @see com.iver.andami.plugins.Extension#postInitialize()
57
	 */
58
	public void postInitialize() {
59
//		lib.postInitialize();		
60
	}
61

  
62
	/* (non-Javadoc)
63
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
64
	 */
65
	public boolean isEnabled() {
66
		return false;
67
	}
68

  
69
	/* (non-Javadoc)
70
	 * @see com.iver.andami.plugins.IExtension#isVisible()
71
	 */
72
	public boolean isVisible() {
73
		return false;
74
	}
75

  
76
}
77

  
0 78

  
tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/src/org/gvsig/fmap/geom/operation/writegml2/PointWriteGml2Operation.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 org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
26
import org.gvsig.fmap.geom.operation.GeometryOperationException;
27
import org.gvsig.fmap.geom.primitive.Point;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class PointWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
		Point point = (Point)geom;
40
				
41
		writerHandler.startPoint(id, new PointCoordinatesSequence(point), srs);
42
		writerHandler.endPoint();
43
		
44
		return null;
45
	}
46
}
0 47

  
tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/src/org/gvsig/fmap/geom/operation/writegml2/MultiCurveWriteGml2Operation.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 org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.aggregate.MultiCurve;
26
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
27
import org.gvsig.fmap.geom.operation.GeometryOperationException;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class MultiCurveWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
        MultiCurve multiCurve = (MultiCurve)geom;
40
        
41
        writerHandler.startMultiLineString(id, srs);
42
        for (int i=0 ; i<multiCurve.getPrimitivesNumber() ; i++){
43
            writerHandler.startLineString(null, new OrientablePrimitiveCoordinateSequence(multiCurve.getCurveAt(i)), srs);
44
            writerHandler.endLineString();
45
        }        
46
        writerHandler.endMultiLineString();
47
        
48
        return null;
49
	}
50
}
0 51

  
tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/src/org/gvsig/fmap/geom/operation/writegml2/PointCoordinatesSequence.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.IOException;
25

  
26
import org.gvsig.fmap.geom.primitive.Point;
27
import org.gvsig.gpe.lib.api.parser.ICoordinateIterator;
28
import org.gvsig.gpe.lib.api.writer.ICoordinateSequence;
29

  
30

  
31
/**
32
 * @author gvSIG Team
33
 * @version $Id$
34
 *
35
 */
36
public class PointCoordinatesSequence implements ICoordinateSequence, ICoordinateIterator {
37
    private Point point = null; 
38
    private boolean hasNext = true;
39
    
40
    public PointCoordinatesSequence(Point point) {
41
        super();
42
        this.point = point;
43
    }
44

  
45
    public int getSize() {       
46
        return 1;
47
    }
48

  
49
    public ICoordinateIterator iterator() {
50
        return this;
51
    }
52

  
53
    public boolean hasNext() throws IOException {
54
        if (hasNext){
55
            hasNext = false;
56
            return true;
57
        }
58
        return false;
59
    }
60

  
61
    public int getDimension() {
62
        return point.getDimension();
63
    }
64

  
65
    public void next(double[] buffer) throws IOException {
66
        for (int i=0 ; i<point.getDimension() ; i++){  
67
            buffer[i] = point.getCoordinateAt(i);   
68
        }          
69
    }
70
}
0 71

  
tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/src/org/gvsig/fmap/geom/operation/writegml2/WriteGml2Operation.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 org.gvsig.fmap.geom.GeometryLocator;
25
import org.gvsig.fmap.geom.GeometryManager;
26
import org.gvsig.fmap.geom.operation.GeometryOperation;
27
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
28
import org.gvsig.gpe.lib.api.writer.IGPEWriterHandler;
29

  
30

  
31
/**
32
 * @author gvSIG Team
33
 * @version $Id$
34
 *
35
 */
36
public abstract class WriteGml2Operation extends GeometryOperation {
37
    public static final String NAME = "writeGml2";
38
	protected static GeometryManager geomManager = GeometryLocator.getGeometryManager();
39
    public static final int CODE = geomManager.getGeometryOperationCode(NAME);	
40
	
41
    protected String id = null;
42
    protected IGPEWriterHandler writerHandler;
43
    protected String srs = null;
44
    
45
	public int getOperationIndex() {
46
		return CODE;
47
	}	
48
	
49
	protected void initializeParams(GeometryOperationContext geometryOperationContext){
50
	    writerHandler = (IGPEWriterHandler)geometryOperationContext.getAttribute(WriteGml2OperationContext.ATTRIBUTE_GPEWRITERHANDLER);
51
	    id = (String)geometryOperationContext.getAttribute(WriteGml2OperationContext.ATTRIBUTE_ID);
52
	    srs = (String)geometryOperationContext.getAttribute(WriteGml2OperationContext.ATTRIBUTE_SRS);
53
	}
54

  
55
}
0 56

  
tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/src/org/gvsig/fmap/geom/operation/writegml2/OrientablePrimitiveCoordinateSequence.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.awt.geom.PathIterator;
25
import java.io.IOException;
26

  
27
import org.gvsig.fmap.geom.primitive.GeneralPathX;
28
import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
29
import org.gvsig.gpe.lib.api.parser.ICoordinateIterator;
30
import org.gvsig.gpe.lib.api.writer.ICoordinateSequence;
31

  
32

  
33
/**
34
 * @author gvSIG Team
35
 * @version $Id$
36
 *
37
 */
38
public class OrientablePrimitiveCoordinateSequence  implements ICoordinateSequence, ICoordinateIterator {
39
    private OrientablePrimitive orientablePrimitive; 
40
    private GeneralPathX generalPathX;
41
    private PathIterator pathIterator;  
42
        
43
    public OrientablePrimitiveCoordinateSequence(
44
        OrientablePrimitive orientablePrimitive) {
45
        super();
46
        this.orientablePrimitive = orientablePrimitive;
47
        this.generalPathX = orientablePrimitive.getGeneralPath();
48
        this.pathIterator = generalPathX.getPathIterator(null);
49
    }
50

  
51
    public boolean hasNext() throws IOException {
52
       return !pathIterator.isDone();
53
    }
54

  
55
    public int getDimension() {
56
        return orientablePrimitive.getDimension();
57
    }
58

  
59
    public void next(double[] buffer) throws IOException {        
60
        pathIterator.currentSegment(buffer);  
61
        pathIterator.next();   
62
    }
63

  
64
    public int getSize() {       
65
        return orientablePrimitive.getNumVertices();
66
    }
67

  
68
    public ICoordinateIterator iterator() {       
69
        return this;
70
    }
71

  
72
}
0 73

  
tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/src/org/gvsig/fmap/geom/operation/writegml2/MultiSurfaceWriteGml2Operation.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 org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.aggregate.MultiSurface;
26
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
27
import org.gvsig.fmap.geom.operation.GeometryOperationException;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class MultiSurfaceWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
        MultiSurface multiSurface = (MultiSurface)geom;
40
        
41
        writerHandler.startMultiPolygon(id, srs);
42
        for (int i=0 ; i<multiSurface.getPrimitivesNumber() ; i++){
43
            writerHandler.startPolygon(null, new OrientablePrimitiveCoordinateSequence(multiSurface.getSurfaceAt(i)), srs);
44
            writerHandler.endPolygon();
45
        }        
46
        writerHandler.endMultiPolygon();
47
        
48
        return null;
49
	}
50
}
0 51

  
tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/src/org/gvsig/fmap/geom/operation/writegml2/CurveWriteGml2Operation.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 org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
26
import org.gvsig.fmap.geom.operation.GeometryOperationException;
27
import org.gvsig.fmap.geom.primitive.Curve;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class CurveWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
        Curve curve = (Curve)geom;
40
        
41
        writerHandler.startLineString(id, new OrientablePrimitiveCoordinateSequence(curve), srs);
42
        writerHandler.endLineString();
43
        
44
        return null;
45
	}
46
}
0 47

  
tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/src/org/gvsig/fmap/geom/operation/writegml2/MultiPointWriteGml2Operation.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 org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.aggregate.MultiPoint;
26
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
27
import org.gvsig.fmap.geom.operation.GeometryOperationException;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class MultiPointWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
        MultiPoint multiPoint = (MultiPoint)geom;
40
        
41
        writerHandler.startMultiPoint(id, srs);
42
        for (int i=0 ; i<multiPoint.getPrimitivesNumber() ; i++){
43
            writerHandler.startPoint(null, new PointCoordinatesSequence(multiPoint.getPointAt(i)), srs);
44
            writerHandler.endPoint();
45
        }        
46
        writerHandler.endMultiPoint();
47
        
48
        return null;
49
	}
50
}
0 51

  
tags/v_2_0_0_Build_2043/extensions/extGPE-gvSIG/src/org/gvsig/fmap/geom/operation/writegml2/WriteGml2OperationContext.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 org.gvsig.fmap.geom.operation.GeometryOperationContext;
25
import org.gvsig.gpe.lib.api.writer.IGPEWriterHandler;
26

  
27

  
28
/**
29
 * @author gvSIG Team
30
 * @version $Id$
31
 *
32
 */
33
public class WriteGml2OperationContext extends GeometryOperationContext {
34
	public static final String ATTRIBUTE_GPEWRITERHANDLER = "writerHandler";
35
	public static final String ATTRIBUTE_SRS = "srs";
36
    public static final String ATTRIBUTE_ID = "id";
37
    
38
    /**
39
     * @return the srs
40
     */
41
    public String getSrs() {
42
        return (String) super.getAttribute(ATTRIBUTE_SRS);
43
    }
44
    
45
    /**
46
     * @param srs the srs to set
47
     */
48
    public void setSrs(String srs) {
49
        this.setAttribute(ATTRIBUTE_SRS, srs);
50
    }   
51
    
52
    /**
53
     * @return the Id
54
     */
55
    public String getId() {
56
        return (String) super.getAttribute(ATTRIBUTE_ID);
57
    }
58
    
59
    /**
60
     * @param id the id to set
61
     */
62
    public void setId(String id) {
63
        this.setAttribute(ATTRIBUTE_ID, id);
64
    }   
65
    
66
    /**
67
     * @return the writerHandler
68
     */
69
    public IGPEWriterHandler getWriterHandler() {
70
        return (IGPEWriterHandler) super.getAttribute(ATTRIBUTE_GPEWRITERHANDLER);
71
    }
72
    
73
    /**
74
     * @param writerHandler the writerHandler to set
75
     */
76
    public void setWriterHandler(IGPEWriterHandler writerHandler) {
77
        this.setAttribute(ATTRIBUTE_GPEWRITERHANDLER, writerHandler);
78
    } 	
79
}
80

  
0 81

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff