Statistics
| Revision:

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

History | View | Annotate | Download (6.94 KB)

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

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

    
6
import org.cresques.cts.IProjection;
7

    
8
import org.gvsig.fmap.geom.Geometry;
9
import org.gvsig.tools.dynobject.DynClass;
10
import org.gvsig.tools.evaluator.Evaluator;
11

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

    
54
        /**
55
         * Returns a new copy of this FeatureType
56
         *
57
         * @return
58
         *                 a new copy of this FeatureType
59
         */
60
        public FeatureType getCopy();
61

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

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

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

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

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

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

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

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

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

    
157
        /**
158
         * Returns this FeatureType identifier. This identifier must always be equal
159
         * to a store.
160
         *
161
         * @return the identifier.
162
         */
163
        public String getId();
164

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

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

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

    
194
        /**
195
         * Returns the SRS in which the default geometry attribute is expressed.
196
         *
197
         * @return
198
         *                 the SRS in which the default geometry attribute is expressed,
199
         *      null if not has a default geometry attribute.
200
         */
201
        public IProjection getDefaultSRS();
202

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

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

    
230
        /**
231
         * Incicates if attibutes with automatic values are allowed in the source
232
         *
233
         * @return true if source supports this feature, false otherwise
234
         */
235
        public boolean allowAutomaticValues();
236

    
237
        /**
238
         * Returns an Array of the FeatureAttributeDescriptor
239
         *
240
         * @return
241
         */
242
        public FeatureAttributeDescriptor[] getAttributeDescriptors();
243

    
244
        /**
245
         * Returns an Array of the FeatureAttributeDescriptor that compounds the
246
         * primary key
247
         *
248
         * @return
249
         */
250
        public FeatureAttributeDescriptor[] getPrimaryKey();
251

    
252
        /**
253
         * Returns the default geometry FeatureAttributeDescriptor. Return null if
254
         * it's not set
255
         *
256
         * @return
257
         */
258
        public FeatureAttributeDescriptor getDefaultGeometryAttribute();
259
        
260
        /**
261
     * Returns the default time FeatureAttributeDescriptor. Return null if
262
     * it's not set.
263
     *
264
     * @return
265
     *          the default time attribute
266
     */
267
        public FeatureAttributeDescriptor getDefaultTimeAttribute();
268

    
269

    
270
}