Revision 11204

View differences:

trunk/libraries/libGPE-GML/src-test/org/gvsig/gpe/gml/writers/GMLMultiPolygonLayerTest.java
1
package org.gvsig.gpe.gml.writers;
2

  
3
import java.io.File;
4
import java.io.IOException;
5

  
6
import org.gvsig.gpe.GPEErrorHandler;
7
import org.gvsig.gpe.gml.writer.GPEGmlWriterHandler;
8
import org.gvsig.gpe.writers.GPELineStringLayerTest;
9
import org.gvsig.gpe.writers.GPEMultiPolygonLayerTest;
10
import org.gvsig.gpe.writers.GPEWriterHandler;
11

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

  
66
	/*
67
	 * (non-Javadoc)
68
	 * @see org.gvsig.gpe.writers.GPEWriterBaseTest#getWriter(java.io.File, org.gvsig.gpe.GPEErrorHandler)
69
	 */
70
	public GPEWriterHandler getWriter(File file, GPEErrorHandler errorHandler) throws IOException {
71
		return new GPEGmlWriterHandler("GML",file,errorHandler);
72
	}
73
}
0 74

  
trunk/libraries/libGPE-GML/src-test/org/gvsig/gpe/gml/writers/GMLMultiPointLayerTest.java
1
package org.gvsig.gpe.gml.writers;
2

  
3
import java.io.File;
4
import java.io.IOException;
5

  
6
import org.gvsig.gpe.GPEErrorHandler;
7
import org.gvsig.gpe.gml.writer.GPEGmlWriterHandler;
8
import org.gvsig.gpe.writers.GPEMultiPointLayerTest;
9
import org.gvsig.gpe.writers.GPEWriterHandler;
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id$
54
 * $Log$
55
 * Revision 1.1  2007-04-13 13:16:00  jorpiell
56
 * Add the multiple geometries
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
62
 */
63
public class GMLMultiPointLayerTest extends GPEMultiPointLayerTest{
64
	/*
65
	 * (non-Javadoc)
66
	 * @see org.gvsig.gpe.writers.GPEWriterBaseTest#getWriter(java.io.File, org.gvsig.gpe.GPEErrorHandler)
67
	 */
68
	public GPEWriterHandler getWriter(File file, GPEErrorHandler errorHandler) throws IOException {
69
		return new GPEGmlWriterHandler("GML",file,errorHandler);
70
	}
71
}
0 72

  
trunk/libraries/libGPE-GML/src-test/org/gvsig/gpe/gml/writers/GMLMultiLineStringLayerTest.java
1
package org.gvsig.gpe.gml.writers;
2

  
3
import java.io.File;
4
import java.io.IOException;
5

  
6
import org.gvsig.gpe.GPEErrorHandler;
7
import org.gvsig.gpe.gml.writer.GPEGmlWriterHandler;
8
import org.gvsig.gpe.writers.GPEMultiLineStringLayerTest;
9
import org.gvsig.gpe.writers.GPEWriterHandler;
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id$
54
 * $Log$
55
 * Revision 1.1  2007-04-13 13:16:00  jorpiell
56
 * Add the multiple geometries
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
62
 */
63
public class GMLMultiLineStringLayerTest extends GPEMultiLineStringLayerTest{
64
	/*
65
	 * (non-Javadoc)
66
	 * @see org.gvsig.gpe.writers.GPEWriterBaseTest#getWriter(java.io.File, org.gvsig.gpe.GPEErrorHandler)
67
	 */
68
	public GPEWriterHandler getWriter(File file, GPEErrorHandler errorHandler) throws IOException {
69
		return new GPEGmlWriterHandler("GML",file,errorHandler);
70
	}
71
}
0 72

  
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/PointMemberWriter.java
1
package org.gvsig.gpe.gml.writer.geometries;
2

  
3
import java.io.IOException;
4
import java.io.Writer;
5

  
6
import org.gvsig.gpe.gml.GMLTags;
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
 * Revision 1.1  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 *
56
 */
57
/**
58
* It writes a GML pointMember label. It is one of the 
59
* MultiPoint elements.
60
* Example:
61
*	<gml:pointMember>
62
*  		<gml:Point srsName='http://www.opengis.net/gml/srs/epsg.xml#23030'>
63
*    		<gml:coordinates>x1,y1,z1
64
*    		</gml:coordinates>
65
* 		</gml:Point>
66
* 	</gml:pointMember>
67
*  
68
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
69
*/
70
public class PointMemberWriter {
71
	
72
	public static void start(Writer writer, double x, double y,
73
			double z, String srs, String id) throws IOException{
74
		writer.write("\n");
75
		writer.write("<" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_POINTMEMBER + ">");
76
		PointWriter.start(writer, x, y, z, srs, id);	
77
	}
78
	
79
	public static void end(Writer writer) throws IOException{
80
		PointWriter.end(writer);
81
		writer.write("\n");
82
		writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_POINTMEMBER + ">");		
83
	}
84
}
0 85

  
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/PolygonWriter.java
49 49
 *
50 50
 * $Id$
51 51
 * $Log$
52
 * Revision 1.1  2007-04-12 10:23:41  jorpiell
52
 * Revision 1.2  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 * Revision 1.1  2007/04/12 10:23:41  jorpiell
53 56
 * Add some writers and the GPEXml parser
54 57
 *
55 58
 *
......
62 65
	public static void start(Writer writer,double[] x, double[] y,
63 66
			double[] z, String srs, String id) throws IOException{
64 67
		GeometriesWriter.startGeometry(writer, GMLTags.GML_POLYGON, id, srs);
65
		
66
		CoordinatesWriter.write(writer, x, y, z);			
68
		OuterBoundaryIsWriter.start(writer, x, y, z);
69
		OuterBoundaryIsWriter.end(writer);
67 70
	}
68 71
	
69 72
	public static void end(Writer writer) throws IOException{
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/MultiLineStringWriter.java
1
package org.gvsig.gpe.gml.writer.geometries;
2

  
3
import java.io.IOException;
4
import java.io.Writer;
5

  
6
import org.gvsig.gpe.gml.GMLTags;
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
 * Revision 1.1  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 *
56
 */
57
/**
58
* It writes a GML MultiLineString label. 
59
* Example:
60
* 	<gml:MultiLineString srsName='http://www.opengis.net/gml/srs/epsg.xml#23030'>
61
* 		<gml:lineStringMember>
62
*  			<gml:LineString srsName='http://www.opengis.net/gml/srs/epsg.xml#23030'>
63
*    			<gml:coordinates>x1,y1,z1
64
*    					x2,y2,z2
65
* 	  			</gml:coordinates>
66
* 			</gml:LineString>
67
* 		</gml:lineStringMemeber>
68
*  </gml:MultiLineString>
69
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
70
*/
71
public class MultiLineStringWriter {
72
	
73
	public static void start(Writer writer, String srs, String id) throws IOException{
74
		GeometriesWriter.startGeometry(writer, GMLTags.GML_MULTILINESTRING, id, srs);
75
	}
76
	
77
	public static void end(Writer writer) throws IOException{
78
		GeometriesWriter.endGeometry(writer, GMLTags.GML_MULTILINESTRING);		
79
	}
80
}
0 81

  
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/OuterBoundaryIsWriter.java
49 49
 *
50 50
 * $Id$
51 51
 * $Log$
52
 * Revision 1.3  2007-04-12 11:36:15  jorpiell
52
 * Revision 1.4  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 * Revision 1.3  2007/04/12 11:36:15  jorpiell
53 56
 * Added new geometry writers
54 57
 *
55 58
 * Revision 1.2  2007/04/12 10:35:04  jorpiell
......
67 70
	
68 71
	public static void start(Writer writer,double[] x, double[] y,
69 72
			double[] z) throws IOException{
73
		writer.write("\n");
70 74
		writer.write("<" +GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_OUTERBOUNDARYIS + ">");		
71 75
		LinearRingWriter.start(writer, x, y, z, null, null);
72 76
	}
73 77
	
74 78
	public static void end(Writer writer) throws IOException{
75 79
		LinearRingWriter.end(writer);
80
		writer.write("\n");
76 81
		writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_OUTERBOUNDARYIS + ">");		
77 82
	}
78 83
}
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/MultiPolygonWriter.java
1
package org.gvsig.gpe.gml.writer.geometries;
2

  
3
import java.io.IOException;
4
import java.io.Writer;
5

  
6
import org.gvsig.gpe.gml.GMLTags;
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
 * Revision 1.1  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 *
56
 */
57
/**
58
* It writes a GML MultiPolygon label. 
59
* Example:
60
* 	<gml:MultiPolygon srsName='http://www.opengis.net/gml/srs/epsg.xml#23030'>
61
* 		<gml:polygonMember>
62
*  			<gml:Polygon srsName='http://www.opengis.net/gml/srs/epsg.xml#23030'>
63
*    			<gml:coordinates>x1,y1,z1
64
*    					x2,y2,z2
65
*    					x3,y3,z3
66
*    					x1,y1,z1*    
67
* 	  			</gml:coordinates>
68
* 			</gml:Polygon>
69
* 		</gml:polygonMember>
70
*  </gml:MultiPolygon>
71
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
72
*/
73
public class MultiPolygonWriter {
74
	
75
	public static void start(Writer writer, String srs, String id) throws IOException{
76
		GeometriesWriter.startGeometry(writer, GMLTags.GML_MULTIPOLYGON, id, srs);
77
	}
78
	
79
	public static void end(Writer writer) throws IOException{
80
		GeometriesWriter.endGeometry(writer, GMLTags.GML_MULTIPOLYGON);		
81
	}
82
}
0 83

  
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/MultiPointWriter.java
1
package org.gvsig.gpe.gml.writer.geometries;
2

  
3
import java.io.IOException;
4
import java.io.Writer;
5

  
6
import org.gvsig.gpe.gml.GMLTags;
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
 * Revision 1.1  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 *
56
 */
57
/**
58
* It writes a GML MultiPoint label. 
59
* Example:
60
* 	<gml:MultiPoint srsName='http://www.opengis.net/gml/srs/epsg.xml#23030'>
61
* 		<gml:pointMember>
62
*  			<gml:Point srsName='http://www.opengis.net/gml/srs/epsg.xml#23030'>
63
*    			<gml:coordinates>x1,y1,z1
64
*    			</gml:coordinates>
65
* 			</gml:Point>
66
* 		</gml:pointMember>
67
*  </gml:MultiPoint>
68
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
69
*/
70
public class MultiPointWriter {
71
	
72
	public static void start(Writer writer, String srs, String id) throws IOException{
73
		GeometriesWriter.startGeometry(writer, GMLTags.GML_MULTIPOINT, id, srs);
74
	}
75
	
76
	public static void end(Writer writer) throws IOException{
77
		GeometriesWriter.endGeometry(writer, GMLTags.GML_MULTIPOINT);		
78
	}
79
}
0 80

  
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/CoordWriter.java
49 49
 *
50 50
 * $Id$
51 51
 * $Log$
52
 * Revision 1.2  2007-04-12 17:06:44  jorpiell
52
 * Revision 1.3  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 * Revision 1.2  2007/04/12 17:06:44  jorpiell
53 56
 * First GML writing tests
54 57
 *
55 58
 * Revision 1.1  2007/04/12 11:36:15  jorpiell
......
71 74
	
72 75
	public static void write(Writer writer,double[] x, double[] y,
73 76
			double[] z) throws IOException{
74
		writer.write("<" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_COORD + ">");
75 77
		for (int i=0 ; i<x.length ; i++){
78
			writer.write("\n");
79
			writer.write("<" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_COORD + ">");
76 80
			writeOneCoordinate(writer,x[i],y[i],z[i]);
81
			writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_COORD + ">");
77 82
		}
78
		writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_COORD + ">");
79 83
	}
80 84
	
81 85
	private static void writeOneCoordinate(Writer writer,double x, double y,
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/LineStringMemberWriter.java
1
package org.gvsig.gpe.gml.writer.geometries;
2

  
3
import java.io.IOException;
4
import java.io.Writer;
5

  
6
import org.gvsig.gpe.gml.GMLTags;
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
 * Revision 1.1  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 *
56
 */
57
/**
58
* It writes a GML lineStringMember label. It is one of the 
59
* MultiLineString elements.
60
* Example:
61
* 	<gml:lineStringMember>
62
*  		<gml:LineString srsName='http://www.opengis.net/gml/srs/epsg.xml#23030'>
63
*    		<gml:coordinates>x1,y1,z1
64
*    				x2,y2,z2
65
* 	  		</gml:coordinates>
66
* 		</gml:LineString>
67
* 	</gml:lineStringMemeber>*  
68
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
69
*/
70
public class LineStringMemberWriter {
71
	
72
	public static void start(Writer writer, double[] x, double[] y,
73
			double[] z, String srs, String id) throws IOException{
74
		writer.write("\n");
75
		writer.write("<" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_LINESTRINGMEMBER + ">");
76
		LineStringWriter.start(writer, x, y, z, srs, id);	
77
	}
78
	
79
	public static void end(Writer writer) throws IOException{
80
		LineStringWriter.end(writer);
81
		writer.write("\n");
82
		writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_LINESTRINGMEMBER + ">");		
83
	}
84
}
0 85

  
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/BoundedByWriter.java
49 49
 *
50 50
 * $Id$
51 51
 * $Log$
52
 * Revision 1.1  2007-04-12 11:36:15  jorpiell
52
 * Revision 1.2  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 * Revision 1.1  2007/04/12 11:36:15  jorpiell
53 56
 * Added new geometry writers
54 57
 *
55 58
 *
......
60 63
public class BoundedByWriter {
61 64
	public static void start(Writer writer,double[] x, double[] y,
62 65
			double[] z, String srs, String id) throws IOException{
66
		writer.write("\n");
63 67
		writer.write("<" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_BOUNDEDBY + ">");	
64 68
		BoxWriter.start(writer, x, y, z, srs, id);
65 69
	}
66 70
	
67 71
	public static void end(Writer writer) throws IOException{
68 72
		BoxWriter.end(writer);
73
		writer.write("\n");
69 74
		writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_BOUNDEDBY + ">");	
70 75
	}
71 76
}
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/InnerBoundaryIs.java
49 49
 *
50 50
 * $Id$
51 51
 * $Log$
52
 * Revision 1.2  2007-04-12 11:36:15  jorpiell
52
 * Revision 1.3  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 * Revision 1.2  2007/04/12 11:36:15  jorpiell
53 56
 * Added new geometry writers
54 57
 *
55 58
 * Revision 1.1  2007/04/12 10:35:04  jorpiell
......
64 67
	
65 68
	public static void start(Writer writer,double[] x, double[] y,
66 69
			double[] z) throws IOException{
70
		writer.write("\n");
67 71
		writer.write("<" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_INNERBOUNDARYIS + ">");		
68 72
		LinearRingWriter.start(writer, x, y, z, null, null);
69 73
	}
70 74
	
71 75
	public static void end(Writer writer) throws IOException{
72 76
		LinearRingWriter.end(writer);
77
		writer.write("\n");
73 78
		writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_INNERBOUNDARYIS + ">");		
74 79
	}
75 80
}
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/geometries/PolygonMemberWriter.java
1
package org.gvsig.gpe.gml.writer.geometries;
2

  
3
import java.io.IOException;
4
import java.io.Writer;
5

  
6
import org.gvsig.gpe.gml.GMLTags;
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
 * Revision 1.1  2007-04-13 13:16:00  jorpiell
53
 * Add the multiple geometries
54
 *
55
 *
56
 */
57
/**
58
* It writes a GML polygonMember label. It is one of the 
59
* MultiPolygon elements.
60
* Example:
61
* 	<gml:polygonMember>
62
*  		<gml:Polygon srsName='http://www.opengis.net/gml/srs/epsg.xml#23030'>
63
*    		<gml:coordinates>x1,y1,z1
64
*    				x2,y2,z2
65
*    				x3,y3,z3
66
*    				x1,y1,z1  
67
* 	  		</gml:coordinates>
68
* 		</gml:Polygon>
69
* 	</gml:polygonMember>  
70
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
71
*/
72
public class PolygonMemberWriter {
73
	
74
	public static void start(Writer writer, double[] x, double[] y,
75
			double[] z, String srs, String id) throws IOException{
76
		writer.write("\n");
77
		writer.write("<" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_POLYGONMEMBER + ">");
78
		PolygonWriter.start(writer, x, y, z, srs, id);	
79
	}
80
	
81
	public static void end(Writer writer) throws IOException{
82
		PolygonWriter.end(writer);
83
		writer.write("\n");
84
		writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_POLYGONMEMBER + ">");		
85
	}
86
}
0 87

  
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/GPEGmlWriterHandler.java
11 11
import org.gvsig.gpe.gml.GMLTags;
12 12
import org.gvsig.gpe.gml.writer.features.ElementWriter;
13 13
import org.gvsig.gpe.gml.writer.features.FeatureMemberWriter;
14
import org.gvsig.gpe.gml.writer.geometries.BoundedByWriter;
14 15
import org.gvsig.gpe.gml.writer.geometries.BoxWriter;
16
import org.gvsig.gpe.gml.writer.geometries.InnerBoundaryIs;
17
import org.gvsig.gpe.gml.writer.geometries.LineStringMemberWriter;
15 18
import org.gvsig.gpe.gml.writer.geometries.LineStringWriter;
16 19
import org.gvsig.gpe.gml.writer.geometries.LinearRingWriter;
20
import org.gvsig.gpe.gml.writer.geometries.MultiLineStringWriter;
21
import org.gvsig.gpe.gml.writer.geometries.MultiPointWriter;
22
import org.gvsig.gpe.gml.writer.geometries.MultiPolygonWriter;
23
import org.gvsig.gpe.gml.writer.geometries.PointMemberWriter;
17 24
import org.gvsig.gpe.gml.writer.geometries.PointWriter;
25
import org.gvsig.gpe.gml.writer.geometries.PolygonMemberWriter;
18 26
import org.gvsig.gpe.gml.writer.geometries.PolygonWriter;
19 27
import org.gvsig.gpe.xml.writer.GPEXmlWriterHandler;
20 28

  
......
64 72
 *
65 73
 * $Id$
66 74
 * $Log$
67
 * Revision 1.3  2007-04-13 07:17:57  jorpiell
75
 * Revision 1.4  2007-04-13 13:16:00  jorpiell
76
 * Add the multiple geometries
77
 *
78
 * Revision 1.3  2007/04/13 07:17:57  jorpiell
68 79
 * Add the writting tests for the simple geometries
69 80
 *
70 81
 * Revision 1.2  2007/04/12 17:06:44  jorpiell
......
79 90
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
80 91
 */
81 92
public class GPEGmlWriterHandler extends GPEXmlWriterHandler{
93
	//In GML there is only one label. It the consumer
94
	//try to add more labels the driver will be report
95
	//one exception
82 96
	private boolean oneLayer = false;
97
	
98
	//Used for the multi-geometries
99
	private boolean isMultiple = false;
100
	
101
	//Used to close the labels
83 102
	private String currentFeature = null;
84
	private String currentElement = null;
103
	private String currentElement = null;	
85 104
	
86 105
	public GPEGmlWriterHandler(String format, File file,GPEErrorHandler errorHandler) throws IOException {
87 106
		super(format, file, errorHandler);		
......
231 250
	 */
232 251
	public void startPoint(String id, double x, double y, double z, String srs) {
233 252
		try {
234
			PointWriter.start(writer, x, y, z, srs, id);
253
			if (isMultiple){
254
				PointMemberWriter.start(writer, x, y, z, srs, id);
255
			}else{
256
				PointWriter.start(writer, x, y, z, srs, id);
257
			}
235 258
		} catch (IOException e) {
236 259
			getErrorHandler().addError(e);
237 260
		}		
......
243 266
	 */
244 267
	public void endPoint() {
245 268
		try {
246
			PointWriter.end(writer);
269
			if (isMultiple){
270
				PointMemberWriter.end(writer);
271
			}else{
272
				PointWriter.end(writer);
273
			}
247 274
		} catch (IOException e) {
248 275
			getErrorHandler().addError(e);
249 276
		}
......
256 283
	 */
257 284
	public void startLineString(String id, double[] x, double[] y, double[] z, String srs) {
258 285
		try {
259
			LineStringWriter.start(writer, x, y, z, srs, id);
286
			if (isMultiple){
287
				LineStringMemberWriter.start(writer, x, y, z, srs, id);
288
			}else{
289
				LineStringWriter.start(writer, x, y, z, srs, id);
290
			}
260 291
		} catch (IOException e) {
261 292
			getErrorHandler().addError(e);
262 293
		}		
......
268 299
	 */
269 300
	public void endLineString() {
270 301
		try {
271
			LineStringWriter.end(writer);
302
			if (isMultiple){
303
				LineStringMemberWriter.end(writer);
304
			}else{
305
				LineStringWriter.end(writer);
306
			}
272 307
		} catch (IOException e) {
273 308
			getErrorHandler().addError(e);
274 309
		}		
......
280 315
	 */
281 316
	public void startBbox(String id, double[] x, double[] y, double[] z, String srs) {
282 317
		try {
283
			BoxWriter.start(writer, x, y, z, srs, id);
318
			BoundedByWriter.start(writer, x, y, z, srs, id);
284 319
		} catch (IOException e) {
285 320
			getErrorHandler().addError(e);
286 321
		}		
......
292 327
	 */
293 328
	public void endBbox() {
294 329
		try {
295
			BoxWriter.end(writer);
330
			BoundedByWriter.end(writer);
296 331
		} catch (IOException e) {
297 332
			getErrorHandler().addError(e);
298 333
		}			
......
328 363
	 */
329 364
	public void startPolygon(String id, double[] x, double[] y, double[] z, String srs) {
330 365
		try {
331
			PolygonWriter.start(writer, x, y, z, srs, id);
366
			if (isMultiple){
367
				PolygonMemberWriter.start(writer, x, y, z, srs, id);
368
			}else{
369
				PolygonWriter.start(writer, x, y, z, srs, id);
370
			}
332 371
		} catch (IOException e) {
333 372
			getErrorHandler().addError(e);
334 373
		}
......
340 379
	 */
341 380
	public void endPolygon() {
342 381
		try {
343
			PolygonWriter.end(writer);
382
			if (isMultiple){
383
				PolygonMemberWriter.end(writer);
384
			}else{
385
				PolygonWriter.end(writer);
386
			}
344 387
		} catch (IOException e) {
345 388
			getErrorHandler().addError(e);
346 389
		}	
347 390
	}
391
	
392
	/*
393
	 * (non-Javadoc)
394
	 * @see org.gvsig.gpe.writers.GPEWriterHandler#startInnerBoundary(java.lang.String, double[], double[], double[], java.lang.String)
395
	 */
396
	public void startInnerBoundary(String id, double[] x, double[] y, double[] z, String srs) {
397
		try {
398
			InnerBoundaryIs.start(writer, x, y, z);
399
		} catch (IOException e) {
400
			getErrorHandler().addError(e);
401
		}
402
	}
403
	
404
	/*
405
	 * (non-Javadoc)
406
	 * @see org.gvsig.gpe.writers.GPEWriterHandler#endInnerBoundary()
407
	 */
408
	public void endInnerBoundary() {
409
		try {
410
			InnerBoundaryIs.end(writer);
411
		} catch (IOException e) {
412
			getErrorHandler().addError(e);
413
		}	
414
	}
415
	
416
	/*
417
	 * (non-Javadoc)
418
	 * @see org.gvsig.gpe.writers.GPEWriterHandler#startMultiPoint(java.lang.String, java.lang.String)
419
	 */
420
	public void startMultiPoint(String id, String srs) {
421
		isMultiple = true;
422
		try {
423
			MultiPointWriter.start(writer, srs, id);
424
		} catch (IOException e) {
425
			getErrorHandler().addError(e);
426
		}
427
	}
428
	
429
	/*
430
	 * (non-Javadoc)
431
	 * @see org.gvsig.gpe.writers.GPEWriterHandler#endMuliPoint()
432
	 */
433
	public void endMuliPoint() {
434
		isMultiple = false;
435
		try {
436
			MultiPointWriter.end(writer);
437
		} catch (IOException e) {
438
			getErrorHandler().addError(e);
439
		}
440
	}
441

  
442
	/*
443
	 * (non-Javadoc)
444
	 * @see org.gvsig.gpe.writers.GPEWriterHandler#startMultiLineString(java.lang.String, java.lang.String)
445
	 */
446
	public void startMultiLineString(String id, String srs) {
447
		isMultiple = true;
448
		try {
449
			MultiLineStringWriter.start(writer, srs, id);
450
		} catch (IOException e) {
451
			getErrorHandler().addError(e);
452
		}
453
	}
454
	
455
	/*
456
	 * (non-Javadoc)
457
	 * @see org.gvsig.gpe.writers.GPEWriterHandler#endMultiLineString()
458
	 */
459
	public void endMultiLineString() {
460
		isMultiple = false;
461
		try {
462
			MultiLineStringWriter.end(writer);
463
		} catch (IOException e) {
464
			getErrorHandler().addError(e);
465
		}
466
	}
467

  
468
	/*
469
	 * (non-Javadoc)
470
	 * @see org.gvsig.gpe.writers.GPEWriterHandler#startMultiPolygon(java.lang.String, java.lang.String)
471
	 */
472
	public void startMultiPolygon(String id, String srs) {
473
		isMultiple = true;
474
		try {
475
			MultiPolygonWriter.start(writer, srs, id);
476
		} catch (IOException e) {
477
			getErrorHandler().addError(e);
478
		}		
479
	}
480
	
481
	/*
482
	 * (non-Javadoc)
483
	 * @see org.gvsig.gpe.writers.GPEWriterHandler#endMultiPolygon()
484
	 */
485
	public void endMultiPolygon() {
486
		isMultiple = false;
487
		try {
488
			MultiPolygonWriter.end(writer);
489
		} catch (IOException e) {
490
			getErrorHandler().addError(e);
491
		}		
492
	}	
348 493
}
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/features/FeatureMemberWriter.java
51 51
 *
52 52
 * $Id$
53 53
 * $Log$
54
 * Revision 1.1  2007-04-12 17:06:44  jorpiell
54
 * Revision 1.2  2007-04-13 13:16:00  jorpiell
55
 * Add the multiple geometries
56
 *
57
 * Revision 1.1  2007/04/12 17:06:44  jorpiell
55 58
 * First GML writing tests
56 59
 *
57 60
 *
......
68 71
		writer.write("\n");
69 72
		writer.write("<" + namespace + name);	
70 73
		if (id != null){
71
			writer.write(" gid=" + id);
74
			writer.write(" fid=" + id);
72 75
		}
73 76
		writer.write(">");			
74 77
	}
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/GMLTags.java
43 43
 *
44 44
 * $Id$
45 45
 * $Log$
46
 * Revision 1.4  2007-04-12 17:06:44  jorpiell
46
 * Revision 1.5  2007-04-13 13:16:00  jorpiell
47
 * Add the multiple geometries
48
 *
49
 * Revision 1.4  2007/04/12 17:06:44  jorpiell
47 50
 * First GML writing tests
48 51
 *
49 52
 * Revision 1.3  2007/04/12 10:35:04  jorpiell
......
117 120
	public static final String GML_LINESTRING = "LineString";
118 121
	public static final String GML_LINEARRING = "LinearRing";
119 122
	public static final String GML_POLYGON = "Polygon";
123
	public static final String GML_MULTIPOINT = "MultiPoint";
124
	public static final String GML_MULTILINESTRING = "MultiLineString";
125
	public static final String GML_MULTIPOLYGON = "MultiPolygon";
120 126
	
121 127
	public static final String GML_OUTERBOUNDARYIS = "outerBoundaryIs";
122 128
	public static final String GML_INNERBOUNDARYIS = "innerBoundaryIs";
129
	public static final String GML_POINTMEMBER = "pointMember";
130
	public static final String GML_LINESTRINGMEMBER = "lineStringMember";
131
	public static final String GML_POLYGONMEMBER = "polygonMember";
123 132
}

Also available in: Unified diff