Statistics
| Revision:

root / trunk / libraries / libGPE-GML / src / org / gvsig / gpe / gml / writer / geometries / LineStringWriter.java @ 11660

History | View | Annotate | Download (3.24 KB)

1
package org.gvsig.gpe.gml.writer.geometries;
2

    
3
import java.io.IOException;
4

    
5
import org.gvsig.gpe.GPEErrorHandler;
6
import org.gvsig.gpe.xml.writer.Writer;
7

    
8
import org.gvsig.gpe.gml.GMLProjectionFactory;
9
import org.gvsig.gpe.gml.GMLTags;
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: LineStringWriter.java 11621 2007-05-14 11:18:12Z jorpiell $
54
 * $Log$
55
 * Revision 1.5  2007-05-14 11:18:12  jorpiell
56
 * Add the ErrorHandler to all the methods
57
 *
58
 * Revision 1.4  2007/05/08 10:24:16  jorpiell
59
 * Add comments to create javadocs
60
 *
61
 * Revision 1.3  2007/04/14 16:07:30  jorpiell
62
 * The writer has been created
63
 *
64
 * Revision 1.2  2007/04/12 17:06:44  jorpiell
65
 * First GML writing tests
66
 *
67
 * Revision 1.1  2007/04/12 10:23:41  jorpiell
68
 * Add some writers and the GPEXml parser
69
 *
70
 *
71
 */
72
/**
73
 * It writes a gml:LineStringType object. Example:
74
 * <p>
75
 * <pre>
76
 * <code>
77
 * &lt;LineString&gt;
78
 * &lt;coord&gt;&lt;X&gt;56.1&lt;/X&gt;&lt;Y&gt;0.45&lt;/Y&gt;&lt;/coord&gt;
79
 * &lt;coord&gt;&lt;X&gt;67.23&lt;/X&gt;&lt;Y&gt;0.98&lt;/Y&gt;&lt;/coord&gt;
80
 * &lt;/LineString&gt;
81
 * </code>
82
 * </pre>
83
 * </p> 
84
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
85
 */
86
public class LineStringWriter {
87
        
88
        /**
89
         * It writes a gml:lineString init tag
90
         * @param writer
91
         * Writer to write the labels
92
         * @param errorHandler
93
         * To add the errors
94
         * @param id
95
         * Geometry ID
96
         * @param x
97
         * X coordinates 
98
         * @param y
99
         * Y coordinates 
100
         * @param z
101
         * Z coordinates 
102
         * @param srs
103
         * Spatial reference system
104
         * @throws IOException
105
         */
106
        public static void start(Writer writer, GPEErrorHandler errorHandler, String id, double[] x, double[] y,
107
                        double[] z, String srs) throws IOException{
108
                GeometriesWriter.startGeometry(writer, errorHandler, GMLTags.GML_LINESTRING, id, srs);
109
                CoordinatesWriter.write(writer, errorHandler, x, y, z);                
110
        }
111
        
112
        /**
113
         * It writes a gml:lineString init tag
114
         * @param writer
115
         * Writer to write the labels
116
         * @param errorHandler
117
         * To add the errors 
118
         * @throws IOException
119
         */
120
        public static void end(Writer writer, GPEErrorHandler errorHandler) throws IOException{
121
                GeometriesWriter.endGeometry(writer, errorHandler, GMLTags.GML_LINESTRING);        
122
        }
123
}