Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / libraries / libRemoteServices / src / org / gvsig / remoteClient / gml / types / GMLGeometries.java @ 9917

History | View | Annotate | Download (5.26 KB)

1
package org.gvsig.remoteClient.gml.types;
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 9917 2007-01-25 16:13:00Z jorpiell $
48
 * $Log$
49
 * Revision 1.1.2.1  2007-01-25 16:12:59  jorpiell
50
 * Se han sustituido las clases por las que hay en el nuevo driver de GML.
51
 *
52
 * Revision 1.1  2006/12/22 11:25:04  csanchez
53
 * Nuevo parser GML 2.x para gml's sin esquema
54
 *
55
 *
56
 */
57

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

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