svn-gvsig-desktop / trunk / libraries / libGPE-GML / src / org / gvsig / gpe / gml / writer / features / FeatureMemberWriter.java @ 12071
History | View | Annotate | Download (3.59 KB)
1 |
package org.gvsig.gpe.gml.writer.features; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import org.gvsig.gpe.gml.GMLTags; |
6 |
import org.gvsig.gpe.gml.utils.GMLUtilsParser; |
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: FeatureMemberWriter.java 12071 2007-06-07 14:53:59Z jorpiell $
|
52 |
* $Log$
|
53 |
* Revision 1.6 2007-06-07 14:53:30 jorpiell
|
54 |
* Add the schema support
|
55 |
*
|
56 |
* Revision 1.5 2007/05/15 09:35:09 jorpiell
|
57 |
* the tag names cant have blanc spaces
|
58 |
*
|
59 |
* Revision 1.4 2007/05/08 10:24:16 jorpiell
|
60 |
* Add comments to create javadocs
|
61 |
*
|
62 |
* Revision 1.3 2007/04/14 16:07:30 jorpiell
|
63 |
* The writer has been created
|
64 |
*
|
65 |
* Revision 1.2 2007/04/13 13:16:00 jorpiell
|
66 |
* Add the multiple geometries
|
67 |
*
|
68 |
* Revision 1.1 2007/04/12 17:06:44 jorpiell
|
69 |
* First GML writing tests
|
70 |
*
|
71 |
*
|
72 |
*/
|
73 |
/**
|
74 |
* A geographic feature is essentially a named list of properties.
|
75 |
* Some or all of these properties may be geospatial, describing
|
76 |
* the position and shape of the feature. Each feature has a type,
|
77 |
* which is equivalent to a class in object modeling terminology,
|
78 |
* such that the class-definition prescribes the named properties
|
79 |
* that a particular feature of that type is required to have.
|
80 |
* <br>
|
81 |
* This class is used to write a feature
|
82 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
83 |
*/
|
84 |
public class FeatureMemberWriter { |
85 |
|
86 |
/**
|
87 |
* It writes a Feature init tag
|
88 |
* @param writer
|
89 |
* Writer to write the labels
|
90 |
* @param id
|
91 |
* Feature id
|
92 |
* @param name
|
93 |
* Feature name
|
94 |
* @param namespace
|
95 |
* Namespace to write before the feature name
|
96 |
* @throws IOException
|
97 |
*/
|
98 |
public static void start(Writer writer, String id, String name, String namespace) throws IOException{ |
99 |
writer.write("\n");
|
100 |
writer.write("<" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_FEATUREMEMBER + ">"); |
101 |
writer.write("\n");
|
102 |
writer.write("<" + namespace + GMLUtilsParser.addBlancSymbol(name));
|
103 |
if (id != null){ |
104 |
writer.write(" " + GMLTags.GML_FID + "=\"" + id + "\""); |
105 |
} |
106 |
writer.write(">");
|
107 |
} |
108 |
|
109 |
/**
|
110 |
* It writes a Feature end tag
|
111 |
* @param writer
|
112 |
* Writer to write the labels
|
113 |
* @param name
|
114 |
* Feature name
|
115 |
* @param namespace
|
116 |
* Namespace to write before the feature name
|
117 |
* @throws IOException
|
118 |
*/
|
119 |
public static void end(Writer writer,String name,String namespace) throws IOException{ |
120 |
writer.write("\n");
|
121 |
writer.write("</" + namespace + GMLUtilsParser.addBlancSymbol(name) + ">"); |
122 |
writer.write("\n");
|
123 |
writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_FEATUREMEMBER + ">"); |
124 |
} |
125 |
|
126 |
|
127 |
} |