svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wfs / WFSFeatureField.java @ 34026
History | View | Annotate | Download (3.54 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.remoteclient.wfs; |
23 |
|
24 |
import java.util.Vector; |
25 |
|
26 |
import org.gvsig.tools.ToolsLocator; |
27 |
import org.gvsig.tools.dataTypes.DataType; |
28 |
import org.gvsig.tools.dataTypes.DataTypes; |
29 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
30 |
|
31 |
|
32 |
/**
|
33 |
* @author gvSIG Team
|
34 |
* @version $Id$
|
35 |
*
|
36 |
*/
|
37 |
public class WFSFeatureField { |
38 |
protected String name; |
39 |
private String type; |
40 |
private DataType dataType = null; |
41 |
private boolean isGeometry = false; |
42 |
private boolean isComplex = false; |
43 |
private int geometryType = -1; |
44 |
private static final DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager(); |
45 |
private Vector fields = new Vector(); |
46 |
|
47 |
public WFSFeatureField() {
|
48 |
dataType = dataTypesManager.get(DataTypes.OBJECT); |
49 |
} |
50 |
|
51 |
public WFSFeatureField(String name, String type, DataType dataType) { |
52 |
super();
|
53 |
this.name = name;
|
54 |
this.type = type;
|
55 |
if (dataType == null){ |
56 |
dataType = dataTypesManager.get(DataTypes.OBJECT); |
57 |
}else{
|
58 |
this.dataType = dataType;
|
59 |
if (dataType.getType() == dataTypesManager.getType("Geometry")){ |
60 |
isGeometry = true;
|
61 |
} |
62 |
} |
63 |
} |
64 |
|
65 |
public WFSFeatureField(String name, String type, int geometryType) { |
66 |
super();
|
67 |
this.name = name;
|
68 |
this.type = type;
|
69 |
this.dataType = dataTypesManager.get(dataTypesManager.getType("Geometry")); |
70 |
this.geometryType = geometryType;
|
71 |
isGeometry = true;
|
72 |
} |
73 |
|
74 |
/**
|
75 |
* @return the name
|
76 |
*/
|
77 |
public String getName() { |
78 |
return name;
|
79 |
} |
80 |
|
81 |
|
82 |
/**
|
83 |
* @return the type
|
84 |
*/
|
85 |
public String getType() { |
86 |
return type;
|
87 |
} |
88 |
|
89 |
/**
|
90 |
* @return the dataType
|
91 |
*/
|
92 |
public DataType getDataType() {
|
93 |
return dataType;
|
94 |
} |
95 |
|
96 |
|
97 |
/**
|
98 |
* @return the isGeometry
|
99 |
*/
|
100 |
public boolean isGeometry() { |
101 |
return isGeometry;
|
102 |
} |
103 |
|
104 |
public boolean isComplex(){ |
105 |
return isComplex;
|
106 |
} |
107 |
|
108 |
/**
|
109 |
* @return the geometryType
|
110 |
*/
|
111 |
public int getGeometryType() { |
112 |
return geometryType;
|
113 |
} |
114 |
|
115 |
/**
|
116 |
* @return Returns the fields.
|
117 |
*/
|
118 |
public WFSFeatureField getFieldAt(int index) { |
119 |
if (index >= fields.size()){
|
120 |
return null; |
121 |
} |
122 |
return (WFSFeatureField)fields.get(index);
|
123 |
} |
124 |
|
125 |
public int getFieldSize(){ |
126 |
return fields.size();
|
127 |
} |
128 |
|
129 |
public void addField(String fieldName, String fieldType, DataType dataType){ |
130 |
isComplex = true;
|
131 |
fields.add(new WFSFeatureField(fieldName, fieldType, dataType));
|
132 |
} |
133 |
|
134 |
public String toString() { |
135 |
return getName();
|
136 |
} |
137 |
|
138 |
|
139 |
} |