Statistics
| Revision:

root / branches / Mobile1.0 / org.gvsig.gpe.gml / src / org / gvsig / gpe / gml / utils / GMLGeometries.java @ 79

History | View | Annotate | Download (6.21 KB)

1
package org.gvsig.gpe.gml.utils;
2

    
3
import java.util.Hashtable;
4

    
5
import javax.xml.namespace.QName;
6

    
7

    
8
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
9
 *
10
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
11
 *
12
 * This program is free software; you can redistribute it and/or
13
 * modify it under the terms of the GNU General Public License
14
 * as published by the Free Software Foundation; either version 2
15
 * of the License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
25
 *
26
 * For more information, contact:
27
 *
28
 *  Generalitat Valenciana
29
 *   Conselleria d'Infraestructures i Transport
30
 *   Av. Blasco Ib??ez, 50
31
 *   46010 VALENCIA
32
 *   SPAIN
33
 *
34
 *      +34 963862235
35
 *   gvsig@gva.es
36
 *      www.gvsig.gva.es
37
 *
38
 *    or
39
 *
40
 *   IVER T.I. S.A
41
 *   Salamanca 50
42
 *   46005 Valencia
43
 *   Spain
44
 *
45
 *   +34 963163400
46
 *   dac@iver.es
47
 */
48
/* CVS MESSAGES:
49
 *
50
 * $Id: GMLGeometries.java 202 2007-11-27 12:00:11Z jpiera $
51
 * $Log$
52
 * Revision 1.1  2007/05/18 10:41:01  csanchez
53
 * Actualizaci?n libGPE-GML eliminaci?n de clases inecesarias
54
 *
55
 * Revision 1.2  2007/05/14 09:31:33  jorpiell
56
 * Add a new method to compare geometries
57
 *
58
 * Revision 1.1  2007/02/28 11:48:31  csanchez
59
 * *** empty log message ***
60
 *
61
 * Revision 1.1  2007/02/20 10:53:20  jorpiell
62
 * A?adidos los proyectos de kml y gml antiguos
63
 *
64
 * Revision 1.1  2006/12/22 11:25:04  csanchez
65
 * Nuevo parser GML 2.x para gml's sin esquema
66
 *
67
 *
68
 */
69

    
70
/************************************************************
71
 * class < Geometries >                                                                                *
72
 * It contains the standard tags specified in GML 2.x                *
73
 * Also, it has functions to parse geometry tags.                        *
74
 * This class help us with the "gml" namespace.                                *
75
 *                                                                                                                         *
76
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)        *
77
 ************************************************************/
78
public class GMLGeometries{
79
        //It has all the drawable geometries
80
        private static Hashtable gmlTags = new Hashtable();
81
        //It has all the tags of GML that it specifies a feature
82
        //private static Hashtable features = new Hashtable();
83
        
84
        static{
85
                //complex geometry elements
86
                gmlTags.put("_Geometry","");
87
                gmlTags.put("_GeometryCollection","");
88
                gmlTags.put("geometryMember","");
89
                gmlTags.put("pointMember","");
90
                gmlTags.put("lineStringMember","");
91
                gmlTags.put("polygonMember","");
92
                gmlTags.put("outerBoundaryIs","");
93
                gmlTags.put("innerBoundaryIs","");
94
                //primitive geometry elements
95
                gmlTags.put("Point","");
96
                gmlTags.put("LineString","");
97
                gmlTags.put("LinearRing","");
98
                gmlTags.put("Polygon","");
99
                gmlTags.put("Box","");
100
                //aggregate geometry elements
101
                gmlTags.put("MultiGeometry","");
102
                gmlTags.put("MultiPoint","");
103
                gmlTags.put("MultiLineString","");
104
                gmlTags.put("MultiPolygon","");
105
                //coordinate elements
106
                gmlTags.put("coord","");
107
                gmlTags.put("X","");
108
                gmlTags.put("Y","");
109
                gmlTags.put("Z","");
110
                gmlTags.put("coordinates","");
111
                //this attribute gives the location where an element is defined
112
                gmlTags.put("remoteSchema","");
113
                //features
114
                gmlTags.put("_Feature","");
115
                gmlTags.put("_FeatureCollection","");
116
                gmlTags.put("featureMember","");
117
                //some basic geometric properties of features
118
                gmlTags.put("_geometryProperty","");
119
                gmlTags.put("geometryProperty","");
120
                gmlTags.put("boundedBy","");
121
                gmlTags.put("pointProperty","");
122
                gmlTags.put("polygonProperty","");
123
                gmlTags.put("lineStringProperty","");
124
                gmlTags.put("multiPointProperty","");
125
                gmlTags.put("multiLineStringProperty","");
126
                gmlTags.put("multiPolygonProperty","");
127
                gmlTags.put("multiGeometryProperty","");
128
                //common aliases for geometry properties
129
                gmlTags.put("location","");
130
                gmlTags.put("centerOf","");
131
                gmlTags.put("position","");
132
                gmlTags.put("extentOf","");
133
                gmlTags.put("coverage","");
134
                gmlTags.put("edgeOf","");
135
                gmlTags.put("centerLineOf","");
136
                gmlTags.put("multiLocation","");
137
                gmlTags.put("multiCenterOf","");
138
                gmlTags.put("multiPosition","");
139
                gmlTags.put("multiCenterLineOf","");
140
                gmlTags.put("multiEdgeOf","");
141
                gmlTags.put("multiCoverage","");
142
                gmlTags.put("multiExtentOf","");
143
                //common feature descriptors
144
                gmlTags.put("description","");
145
                gmlTags.put("name","");
146
        
147
                /**********************************************************
148
                 * Added geometries for GML 3 SFP(Simple Feature Profile) *
149
                 **********************************************************/
150
                gmlTags.put("MultiPoint","");
151
                gmlTags.put("MultiCurve","");
152
                gmlTags.put("MultiSurface","");
153
                gmlTags.put("pointMember","");
154
                gmlTags.put("surfaceMember","");
155
                gmlTags.put("Curve","");
156
                gmlTags.put("segments","");
157
                gmlTags.put("curveMember","");
158
                gmlTags.put("LineStringSegment","");
159
                gmlTags.put("patches","");
160
                gmlTags.put("PolygonPatch","");
161
                gmlTags.put("Surface","");
162
                gmlTags.put("Polygon","");
163
                gmlTags.put("exterior","");
164
                gmlTags.put("interior","");
165
                gmlTags.put("LinearRing","");
166
                gmlTags.put("Point","");
167
                gmlTags.put("LineString","");
168
                gmlTags.put("pos","");
169
                gmlTags.put("posList","");
170
                gmlTags.put("Envelope","");
171
                gmlTags.put("boundedBy","");
172
                gmlTags.put("description","");
173
                gmlTags.put("name","");
174
                gmlTags.put("curveProperty","");
175
                gmlTags.put("surfaceProperty","");
176
                gmlTags.put("multiCurveProperty","");
177
                gmlTags.put("multiSurfaceProperty","");
178
        
179
        }
180

    
181
        private QName tag;
182
        
183
        /**
184
         * It search a tag in the geometry hashtable
185
         *         -if it isn't, then returns false.
186
         *         -else it is a GML 2.x stardard geometry and return true
187
         * @return 
188
         * 
189
         * @return boolean
190
         **/
191
        public static boolean isGeometryGML(QName tag){
192
                return (gmlTags.get(tag.getLocalPart())!=null);
193
        }
194
        
195
        /**
196
         * Return if the tag is a geometry
197
         * @param tag
198
         * XML tag to compare
199
         * @return 
200
         * true if the tag is a geometry
201
         */
202
        public static boolean isGML(QName tag){
203
                if (tag.getNamespaceURI() != null){
204
                                 if(tag.getNamespaceURI().equals(GMLTags.GML_NAMESPACE_URI))
205
                                        return isGeometryGML(tag);
206
                }                
207
                return false;
208
        }
209
}