Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wfs / WFSFeatureField.java @ 40559

History | View | Annotate | Download (3.59 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.remoteclient.wfs;
25

    
26
import java.util.Vector;
27

    
28
import org.gvsig.tools.ToolsLocator;
29
import org.gvsig.tools.dataTypes.DataType;
30
import org.gvsig.tools.dataTypes.DataTypes;
31
import org.gvsig.tools.dataTypes.DataTypesManager;
32

    
33

    
34
/**
35
 * @author gvSIG Team
36
 * @version $Id$
37
 *
38
 */
39
public class WFSFeatureField {
40
    protected String name;
41
    private String type;
42
    private DataType dataType = null;   
43
    private boolean isGeometry = false;
44
    private boolean isComplex = false;
45
    private int geometryType = -1;
46
    private static final DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager();
47
    private Vector fields = new Vector();
48
    
49
    public WFSFeatureField() {
50
        dataType = dataTypesManager.get(DataTypes.OBJECT);
51
    }
52
    
53
    public WFSFeatureField(String name, String type, DataType dataType) {
54
        super();
55
        this.name = name;
56
        this.type = type;
57
        if (dataType == null){
58
            dataType = dataTypesManager.get(DataTypes.OBJECT);
59
        }else{
60
            this.dataType = dataType;
61
            if (dataType.getType() == dataTypesManager.getType("Geometry")){
62
                isGeometry = true;
63
            }
64
        }
65
    }
66
    
67
    public WFSFeatureField(String name, String type, int geometryType) {
68
        super();
69
        this.name = name;
70
        this.type = type;
71
        this.dataType = dataTypesManager.get(dataTypesManager.getType("Geometry"));  
72
        this.geometryType = geometryType;
73
        isGeometry = true;
74
    }
75
    
76
    /**
77
     * @return the name
78
     */
79
    public String getName() {
80
        return name;
81
    }
82

    
83
    
84
    /**
85
     * @return the type
86
     */
87
    public String getType() {
88
        return type;
89
    }
90
    
91
    /**
92
     * @return the dataType
93
     */
94
    public DataType getDataType() {
95
        return dataType;
96
    }
97

    
98
    
99
    /**
100
     * @return the isGeometry
101
     */
102
    public boolean isGeometry() {
103
        return isGeometry;
104
    }
105

    
106
    public boolean isComplex(){
107
        return isComplex;
108
    }
109
    
110
    /**
111
     * @return the geometryType
112
     */
113
    public int getGeometryType() {
114
        return geometryType;
115
    }
116
    
117
    /**
118
     * @return Returns the fields.
119
     */
120
    public WFSFeatureField getFieldAt(int index) {
121
        if (index >= fields.size()){
122
            return null;
123
        }
124
        return (WFSFeatureField)fields.get(index);
125
    }
126
    
127
    public int getFieldSize(){
128
        return fields.size();
129
    }
130

    
131
    public void addField(String fieldName, String fieldType, DataType dataType){
132
        isComplex = true;
133
        fields.add(new WFSFeatureField(fieldName, fieldType, dataType));
134
    }
135
    
136
    public String toString() {
137
        return getName();
138
    }
139
    
140
    
141
}