Statistics
| Revision:

root / org.gvsig.xmlschema / library / trunk / org.gvsig.xmlschema / org.gvsig.xmlschema.prov / org.gvsig.xmlschema.prov.kxml / src / main / java / org / gvsig / xmlschema / prov / kxml / xsd / type / GMLGeometries.java @ 250

History | View | Annotate | Download (5.2 KB)

1
package org.gvsig.xmlschema.prov.kxml.xsd.type;
2

    
3
import java.util.Hashtable;
4

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

    
55
/************************************************************
56
 * class < Geometries >                                                                                *
57
 * It contains the standard tags specified in GML 2.x                *
58
 * Also, it has functions to parse geometry tags.                        *
59
 * This class help us with the "gml" namespace.                                *
60
 *                                                                                                                         *
61
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)        *
62
 ************************************************************/
63
public class GMLGeometries{
64
        //It has all the drawable geometries
65
        private static Hashtable geometries = new Hashtable();
66
        //It has all the tags of GML that it specifies a feature
67
        private static Hashtable features = new Hashtable();
68
        
69
        static{
70
                //complex geometry elements
71
                geometries.put("_Geometry","");
72
                geometries.put("_GeometryCollection","");
73
                geometries.put("geometryMember","");
74
                geometries.put("pointMember","");
75
                geometries.put("lineStringMember","");
76
                geometries.put("polygonMember","");
77
                geometries.put("outerBoundaryIs","");
78
                geometries.put("innerBoundaryIs","");
79
                //primitive geometry elements
80
                geometries.put("Point","");
81
                geometries.put("LineString","");
82
                geometries.put("LinearRing","");
83
                geometries.put("Polygon","");
84
                geometries.put("Box","");
85
                //aggregate geometry elements
86
                geometries.put("MultiGeometry","");
87
                geometries.put("MultiPoint","");
88
                geometries.put("MultiLineString","");
89
                geometries.put("MultiPolygon","");
90
                //coordinate elements
91
                geometries.put("coord","");
92
                geometries.put("X","");
93
                geometries.put("Y","");
94
                geometries.put("Z","");
95
                geometries.put("coordinates","");
96
                //this attribute gives the location where an element is defined
97
                geometries.put("remoteSchema","");
98
        }
99
        static{
100
                //features
101
                features.put("_Feature","");
102
                features.put("_FeatureCollection","");
103
                features.put("featureMember","");
104
                //some basic geometric properties of features
105
                features.put("_geometryProperty","");
106
                features.put("geometryProperty","");
107
                features.put("boundedBy","");
108
                features.put("pointProperty","");
109
                features.put("polygonProperty","");
110
                features.put("lineStringProperty","");
111
                features.put("multiPointProperty","");
112
                features.put("multiLineStringProperty","");
113
                features.put("multiPolygonProperty","");
114
                features.put("multiGeometryProperty","");
115
                //common aliases for geometry properties
116
                features.put("location","");
117
                features.put("centerOf","");
118
                features.put("position","");
119
                features.put("extentOf","");
120
                features.put("coverage","");
121
                features.put("edgeOf","");
122
                features.put("centerLineOf","");
123
                features.put("multiLocation","");
124
                features.put("multiCenterOf","");
125
                features.put("multiPosition","");
126
                features.put("multiCenterLineOf","");
127
                features.put("multiEdgeOf","");
128
                features.put("multiCoverage","");
129
                features.put("multiExtentOf","");
130
                //common feature descriptors
131
                features.put("description","");
132
                features.put("name","");
133
        }
134

    
135
        private String tag;
136
        
137
        /**
138
         * Class constructor
139
         **/
140
        public GMLGeometries(String actual){
141
                this.tag = actual;
142
        }
143
        
144
        /**
145
         * It search a tag in the both of GML hashtables
146
         *         -if it isn't, then returns false.
147
         *         -else it is a GML 2.x stardard tag and return true
148
         * 
149
         * @return boolean
150
         **/
151
        public boolean isGML(){
152
                boolean ok;
153
                if (isGeometryGML()==true){
154
                        ok=true;
155
                }
156
                else if (isFeatureGML()==true){
157
                        ok=true;
158
                }
159
                else{
160
                        ok=false;
161
                }
162
                return (ok);
163
        }
164
        
165
        /**
166
         * It search a tag in the geometry hashtable
167
         *         -if it isn't, then returns false.
168
         *         -else it is a GML 2.x stardard geometry and return true
169
         * 
170
         * @return boolean
171
         **/
172
        public boolean isGeometryGML(){
173
                return (geometries.get(tag)!=null);
174
        }
175
        
176
        /**
177
         * It search a tag in the feature hashtable
178
         *         -if it isn't, then returns false.
179
         *         -else it is a GML 2.x stardard feature tag and return true
180
         * 
181
         * @return boolean
182
         **/
183
        public boolean isFeatureGML(){
184
                return (features.get(tag)!=null);
185
        }
186
}