root / trunk / libraries / libGPE-KML / src / org / gvsig / gpe / kml / writer / geometries / GeometriesWriter.java @ 11484
History | View | Annotate | Download (2.71 KB)
1 | 11435 | jorpiell | package org.gvsig.gpe.kml.writer.geometries; |
---|---|---|---|
2 | |||
3 | import java.io.IOException; |
||
4 | |||
5 | import org.gvsig.gpe.gml.GMLTags; |
||
6 | import org.gvsig.gpe.kml.KmlTags; |
||
7 | import org.gvsig.gpe.xml.writer.Writer; |
||
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$
|
||
52 | * $Log$
|
||
53 | 11484 | jorpiell | * Revision 1.2 2007-05-08 07:53:08 jorpiell
|
54 | * Add comments to the writers
|
||
55 | *
|
||
56 | * Revision 1.1 2007/05/02 11:46:50 jorpiell
|
||
57 | 11435 | jorpiell | * Writing tests updated
|
58 | *
|
||
59 | *
|
||
60 | */
|
||
61 | /**
|
||
62 | 11484 | jorpiell | * A Geometry element is an abstract element and cannot be used
|
63 | * directly in a KML file. It provides a placeholder object for
|
||
64 | * all derived Geometry objects.
|
||
65 | * <br>
|
||
66 | * This class has methods to write the common parts.
|
||
67 | 11435 | jorpiell | * @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
68 | 11484 | jorpiell | * @see http://code.google.com/apis/kml/documentation/kml_tags_21.html#geometry
|
69 | 11435 | jorpiell | */
|
70 | public class GeometriesWriter { |
||
71 | |||
72 | 11484 | jorpiell | /**
|
73 | * It writes the geometry init tag and its attributes
|
||
74 | * @param writer
|
||
75 | * Writer to write the labels
|
||
76 | * @param tagName
|
||
77 | * Geometry tag name
|
||
78 | * @param id
|
||
79 | * Geometry id
|
||
80 | * @throws IOException
|
||
81 | */
|
||
82 | 11435 | jorpiell | public static void startGeometry(Writer writer,String tagName,String id) throws IOException{ |
83 | writer.write("\n");
|
||
84 | writer.write("<" + tagName);
|
||
85 | if (id != null){ |
||
86 | writer.write(" " + KmlTags.GEOMETRY_ID + "='" + id + "'"); |
||
87 | } |
||
88 | writer.write(">");
|
||
89 | } |
||
90 | |||
91 | 11484 | jorpiell | /**
|
92 | * It writes the geometry end tag
|
||
93 | * @param writer
|
||
94 | * Writer to write the labels
|
||
95 | * @param tagName
|
||
96 | * Geometry tag name
|
||
97 | * @throws IOException
|
||
98 | */
|
||
99 | 11435 | jorpiell | public static void endGeometry(Writer writer,String tagName) throws IOException{ |
100 | writer.write("\n");
|
||
101 | writer.write("</" + tagName + ">"); |
||
102 | } |
||
103 | } |