Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libGPE-KML / src / org / gvsig / gpe / kml / writer / v21 / geometries / LinearRingWriter.java @ 19367

History | View | Annotate | Download (3.37 KB)

1 18284 jpiera
package org.gvsig.gpe.kml.writer.v21.geometries;
2
3
import java.io.IOException;
4
5
import org.gvsig.gpe.kml.KmlTags;
6
import org.gvsig.gpe.kml.writer.GPEKmlWriterHandlerImplementor;
7 19367 jpiera
import org.gvsig.gpe.xml.writer.IWriter;
8 18284 jpiera
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: LinearRingWriter.java 361 2008-01-10 08:41:21Z jpiera $
52
 * $Log$
53
 * Revision 1.4  2007/06/28 13:05:27  jorpiell
54
 * The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class
55
 *
56
 * Revision 1.3  2007/05/16 09:30:09  jorpiell
57
 * the writting methods has to have the errorHandler argument
58
 *
59
 * Revision 1.2  2007/05/08 07:53:08  jorpiell
60
 * Add comments to the writers
61
 *
62
 * Revision 1.1  2007/04/14 16:08:07  jorpiell
63
 * Kml writing support added
64
 *
65
 *
66
 */
67
/**
68
 * It writes the linearRing KML tag. Example:
69
 * <p>
70
 * <pre>
71
 * <code>
72
 * &lt;LinearRing&gt;
73
 * &lt;coordinates&gt;0.0,0.0 100.0,0.0 50.0,100.0 0.0,0.0&lt;/coordinates&gt;
74
 * &lt;/LinearRing&gt;
75
 * </code>
76
 * </pre>
77
 * </p>
78
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
79
 * @see http://code.google.com/apis/kml/documentation/kml_tags_21.html#linearring
80
 */
81
public class LinearRingWriter {
82
83
        /**
84
         * It writes the linearRinzg kml init tag
85
         * @param writer
86
         * Writer to write the labels
87
         * @param handler
88
         * The writer handler implementor
89
         * @param longitudes
90
         * Array of longitudes (>= -180 and <= 180)
91
         * @param latitudes
92
         * Array of latitudes (>= -90 and <= 90)
93
         * @param altitudes
94
         * Array of altitudes (Meters above sea level)
95
         * @throws IOException
96
         */
97 19367 jpiera
        public void start(IWriter writer, GPEKmlWriterHandlerImplementor handler, double[] longitudes, double[] latitudes,
98 18284 jpiera
                        double[] altitudes) throws IOException{
99
                writer.write("\n");
100
                writer.write("<" + KmlTags.LINEARRING + ">");
101
                handler.getProfile().getCoordinatesWriter().write(writer, handler, longitudes, latitudes, altitudes);
102
        }
103
104
        /**
105
         * It writes the linearRing kml end tag
106
         * @param writer
107
         * Writer to write the labels
108
         * @param handler
109
         * The writer handler implementor
110
         * @throws IOException
111
         */
112 19367 jpiera
        public void end(IWriter writer, GPEKmlWriterHandlerImplementor handler) throws IOException{
113 18284 jpiera
                writer.write("\n");
114
                writer.write("</" + KmlTags.LINEARRING + ">");
115
        }
116
}