svn-gvsig-desktop / branches / v10 / libraries / libGPE-KML / src / org / gvsig / gpe / kml / writer / v21 / features / PlaceMarkWriter.java @ 18284
History | View | Annotate | Download (3.41 KB)
1 | 18284 | jpiera | package org.gvsig.gpe.kml.writer.v21.features; |
---|---|---|---|
2 | |||
3 | import java.io.IOException; |
||
4 | |||
5 | import org.gvsig.gpe.kml.KmlTags; |
||
6 | import org.gvsig.gpe.kml.writer.GPEKmlWriterHandlerImplementor; |
||
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: PlaceMarkWriter.java 361 2008-01-10 08:41:21Z jpiera $
|
||
52 | * $Log$
|
||
53 | * Revision 1.5 2007/05/16 09:30:09 jorpiell
|
||
54 | * the writting methods has to have the errorHandler argument
|
||
55 | *
|
||
56 | * Revision 1.4 2007/05/08 08:22:37 jorpiell
|
||
57 | * Add comments to create javadocs
|
||
58 | *
|
||
59 | * Revision 1.3 2007/05/08 07:53:08 jorpiell
|
||
60 | * Add comments to the writers
|
||
61 | *
|
||
62 | * Revision 1.2 2007/04/20 08:38:59 jorpiell
|
||
63 | * Tests updating
|
||
64 | *
|
||
65 | * Revision 1.1 2007/04/14 16:08:07 jorpiell
|
||
66 | * Kml writing support added
|
||
67 | *
|
||
68 | *
|
||
69 | */
|
||
70 | /**
|
||
71 | * This class writes a PlaceMark kml tag. Example:
|
||
72 | * <p>
|
||
73 | * <pre>
|
||
74 | * <code>
|
||
75 | * <Placemark>
|
||
76 | * <name>CDATA example</name>
|
||
77 | * <description>Description example</description>
|
||
78 | * <Point>
|
||
79 | * <oordinates>102.595626,14.996729</coordinates>
|
||
80 | * </Point>
|
||
81 | * </Placemark>
|
||
82 | * </code>
|
||
83 | * </pre>
|
||
84 | * </p>
|
||
85 | * @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
||
86 | * @see http://code.google.com/apis/kml/documentation/kml_tags_21.html#placemark
|
||
87 | */
|
||
88 | public class PlaceMarkWriter { |
||
89 | |||
90 | /**
|
||
91 | * Writes a PlaceMark init tag and its attributes
|
||
92 | * @param writer
|
||
93 | * Writer to write the labels
|
||
94 | * @param handler
|
||
95 | * The writer handler implementor
|
||
96 | * @param id
|
||
97 | * PlaceMark id
|
||
98 | * @param name
|
||
99 | * PlaceMark name
|
||
100 | *
|
||
101 | * @throws IOException
|
||
102 | */
|
||
103 | public void start(Writer writer, GPEKmlWriterHandlerImplementor handler, String id, String name) throws IOException{ |
||
104 | handler.getProfile().getFeatureWriter().start(writer, handler, id, KmlTags.PLACEMARK); |
||
105 | if (id != null){ |
||
106 | writer.write(" id=\"" + id + "\""); |
||
107 | } |
||
108 | writer.write(">");
|
||
109 | if (name != null){ |
||
110 | handler.getProfile().getNameWriter().write(writer, handler, name); |
||
111 | } |
||
112 | } |
||
113 | |||
114 | /**
|
||
115 | * It writes the end PlaceMark tag
|
||
116 | * @param writer
|
||
117 | * Writer to write the labels
|
||
118 | * @param handler
|
||
119 | * The writer handler implementor
|
||
120 | * @throws IOException
|
||
121 | */
|
||
122 | public void end(Writer writer, GPEKmlWriterHandlerImplementor handler) throws IOException{ |
||
123 | handler.getProfile().getFeatureWriter().end(writer, handler, KmlTags.PLACEMARK); |
||
124 | } |
||
125 | } |