Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / FeatureType.java @ 25530

History | View | Annotate | Download (5.83 KB)

1
package org.gvsig.fmap.dal.feature;
2

    
3
import java.util.Iterator;
4
import java.util.List;
5

    
6
import org.gvsig.fmap.geom.Geometry;
7
import org.gvsig.tools.evaluator.Evaluator;
8

    
9
/**
10
 * <p>
11
 * This interface provides all the information that describes the structure of 
12
 * a type of feature, methods for managing it and also offers a variety of utility 
13
 * methods for simplicity's sake.
14
 * </p>
15
 * 
16
 * <p>
17
 * The relevant information that compounds a FeatureType includes:
18
 * </p>
19
 * 
20
 *  <ul>
21
 *  <li> {@link FeatureAttributeDescriptor}(s)
22
 *  <li> {@link FeatureRule}(s)
23
 *  <li> Its size
24
 *  <li> Its SRS(s)
25
 *  <li> Its identifier
26
 *  <li> Whether features of this type have an OID or not (identifier assigned by the store).
27
 * </ul>
28
 * 
29
 * <p>
30
 * Methods for management include:
31
 * </p>
32
 * 
33
 *  <ul>
34
 *  <li>Obtaining its editable instance.
35
 *  <li>Obtaining an iterator over its attributes.
36
 *  <li>Knowing whether this FeatureType has any associated evaluator for calculated attributes.
37
 *  </ul>
38
 * 
39
 * <p>
40
 * Utility methods include:
41
 * </p>
42
 * 
43
 * <ul>
44
 * <li>Getting a copy of the FeatureType.
45
 * <li>Getting the default geometry attribute.
46
 * <li>Getting the default spatial reference system.
47
 * <ul/>
48
 */
49
public interface FeatureType {
50

    
51
        /**
52
         * Returns a new copy of this FeatureType
53
         * 
54
         * @return
55
         *                 a new copy of this FeatureType
56
         */
57
        public FeatureType getCopy();
58

    
59
        /**
60
         * Returns a {@link FeatureRules} containing
61
         * all rules applicable to features of this type.
62
         * 
63
         * @return
64
         *                 a {@link FeatureRules} containing all rules 
65
         *                 applicable to features of this type.
66
         */
67
        public FeatureRules getRules();
68

    
69
        /**
70
         * Returns an editable instance of this FeatureType.
71
         * Any modifications on a FeatureType must be done
72
         * through its editable instance.
73
         * 
74
         * @return
75
         *                 the editable instance of this FeatureType.
76
         * 
77
         * @see EditableFeatureType
78
         */
79
        public EditableFeatureType getEditable();
80

    
81
        /**
82
         * Given the name of an attribute, this method returns 
83
         * its position in this FeatureType.
84
         * 
85
         * @param name
86
         *                         of the attribute
87
         * @return
88
         *                 position of the attribute
89
         */
90
        public int getIndex(String name);
91

    
92
        /**
93
         * Returns an attribute descriptor given its name.
94
         * 
95
         * @param name
96
         *                         of the attribute
97
         * @return
98
         *                 descriptor of the attribute, a {@link FeatureAttributeDescriptor}.
99
         */
100
        public Object get(String name);
101

    
102
        /**
103
         * Returns an attribute descriptor given its index
104
         * 
105
         * @param index
106
         *                         of the attribute
107
         * 
108
         * @return
109
         *                 descriptor of the attribute, a {@link FeatureAttributeDescriptor}
110
         */
111
        public Object get(int index);
112

    
113
        /**
114
         * Returns a {@link FeatureAttributeDescriptor} given the attribute name.
115
         * 
116
         * @param name
117
         *                         of the attribute
118
         * 
119
         * @return
120
         *                 a {@link FeatureAttributeDescriptor}
121
         */
122
        public FeatureAttributeDescriptor getAttributeDescriptor(String name);
123

    
124
        /**
125
         * Returns a {@link FeatureAttributeDescriptor} given the attribute index.
126
         * 
127
         * @param index
128
         *                         of the attribute
129
         * 
130
         * @return
131
         *                 a {@link FeatureAttributeDescriptor}
132
         */
133
        public FeatureAttributeDescriptor getAttributeDescriptor(int index);
134

    
135
        /**
136
         * Returns an iterator over this FeatureType's attributes. Elements
137
         * returned by this iterator are of type {@link FeatureAttributeDescriptor}.
138
         * 
139
         * @return
140
         *                 An iterator over this FeatureType's {@link FeatureAttributeDescriptor}s.
141
         */
142
        public Iterator iterator();
143

    
144
        /**
145
         * Returns this FeatureType size. The size of a FeatureType is determined
146
         * by its number of attributes.
147
         * 
148
         * @return
149
         *                 this FeatureType size, defined as the number of attributes it is composed of.
150
         *                 
151
         */
152
        public int size();
153

    
154
        /**
155
         * Returns this FeatureType identifier.
156
         *  
157
         * @return
158
         *                 the identifier.
159
         */
160
        public String getId();
161

    
162
        /**
163
         * Returns the name of the attribute that will be used as default
164
         * geometry attribute for those processes that require a geometry (for
165
         * instance rendering).
166
         * 
167
         * @return
168
         *                 name of the default geometry attribute.
169
         */
170
        public String getDefaultGeometryAttributeName();
171

    
172
        /**
173
         * Returns the index of the attribute that will be used as default
174
         * geometry attribute.
175
         * 
176
         * @return
177
         *                 index of the default geometry attribute.
178
         */
179
        public int getDefaultGeometryAttributeIndex();
180

    
181
        /**
182
         * Returns a list with the SRSs in which this FeatureType geometries are 
183
         * expressed. Normally there may be one SRS for each attribute of type 
184
         * {@link Geometry}.
185
         * 
186
         * @return
187
         *                 a list with the SRS in which this FeatureType geometries are expressed.
188
         */
189
        public List getSRSs();
190

    
191
        /**
192
         * Returns the SRS in which the default geometry attribute is expressed.
193
         * 
194
         * @return
195
         *                 the SRS in which the default geometry attribute is expressed.
196
         */
197
        public String getDefaultSRS();
198

    
199
        /**
200
         * Indicates whether this FeatureType has any assigned {@link Evaluator}(s).
201
         * Evaluators are used to obtain the values for calculated 
202
         * attributes.
203
         * 
204
         * @return
205
         *                 true if this FeatureType has any assigned {@link Evaluator}(s).
206
         */
207
        public boolean hasEvaluators(); // FIXME: Quitar del interface y dejar en DefaultFeatureType
208

    
209
        /**
210
         * Indicates whether {@link Feature}(s) of this FeatureType have an OID defined. 
211
         * An OID is the Feature unique identifier. 
212
         * 
213
         * Some stores provide their own OIDs which are always unique 
214
         * (such as Postgre) while others don't support this concept and 
215
         * then it is the library who creates runtime ad-hoc OIDs as 
216
         * it see fits, but then integrity of this OIDs among different 
217
         * work sessions cannot be guaranteed (this is the case for shape 
218
         * files).
219
         * 
220
         * @return
221
         *                 true if this FeatureType has an OID defined, false otherwise.
222
         *                 
223
         */
224
        public boolean hasOID();
225

    
226
}