Statistics
| Revision:

root / trunk / libraries / libGPE-KML / src / org / gvsig / gpe / kml / writer / v21 / geometries / MultiGeometryWriter.java @ 21966

History | View | Annotate | Download (3.33 KB)

1
package org.gvsig.gpe.kml.writer.v21.geometries;
2

    
3
import java.io.IOException;
4

    
5
import org.gvsig.gpe.kml.utils.Kml2_1_Tags;
6
import org.gvsig.gpe.kml.writer.GPEKmlWriterHandlerImplementor;
7
import org.gvsig.gpe.xml.stream.IXmlStreamWriter;
8

    
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id: MultiGeometryWriter.java 361 2008-01-10 08:41:21Z jpiera $
52
 * $Log$
53
 * Revision 1.2  2007/05/16 09:30:09  jorpiell
54
 * the writting methods has to have the errorHandler argument
55
 *
56
 * Revision 1.1  2007/05/15 12:37:45  jorpiell
57
 * Add multyGeometries
58
 *
59
 *
60
 */
61
/**
62
 * It writes a MultyGeometry tag. Example:
63
 * <p>
64
 * <pre>
65
 * <code>
66
 * &lt;MultiGeometry&gt;
67
 * &lt;Point gid="P6776"&gt;
68
 * &lt;coord&gt;&lt;X&gt;50.0&lt;/X&gt;&lt;Y&gt;50.0&lt;/Y&gt;&lt;/coord&gt;
69
 * &lt;/Point&gt;
70
 * &lt;Polygon gid="_877789"&gt;
71
 * &lt;outerBoundaryIs&gt;
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
 * &lt;/outerBoundaryIs&gt;
76
 * &lt;/Polygon&gt;
77
 * &lt;MultiGeometry&gt;
78
 * </code>
79
 * </pre>
80
 * </p> 
81
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
82
 * @see http://code.google.com/apis/kml/documentation/kml_tags_21.html#multigeometry
83
 */
84
public class MultiGeometryWriter {
85
        /**
86
         * It writes the MultiGeometry init tag and its value.
87
         * @param writer
88
         * Writer to write the labels
89
         * @param handler
90
         * The writer handler implementor
91
         * @param id
92
         * Point id
93
         * @param longitude
94
         * Longitude >= -180 and <= 180
95
         * @param latitude
96
         * Latitude >= -90 and <= 90
97
         * @param altitude
98
         * Meters above sea level
99
         * @throws IOException
100
         */
101
        public void start(IXmlStreamWriter writer, GPEKmlWriterHandlerImplementor handler, String id) throws IOException{
102
                handler.getProfile().getGeometryWriter().startGeometry(writer, handler, Kml2_1_Tags.MULTIGEOMETRY, id);
103
        }
104
        
105
        /**
106
         * It writes the MultiGeometry end tag
107
         * @param writer
108
         * Writer to write the labels
109
         * @param handler
110
         * The writer handler implementor
111
         * @throws IOException
112
         */
113
        public void end(IXmlStreamWriter writer, GPEKmlWriterHandlerImplementor handler) throws IOException{
114
                handler.getProfile().getGeometryWriter().endGeometry(writer, handler, Kml2_1_Tags.MULTIGEOMETRY);
115
        }
116
}