Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / feature / FeatureType.java @ 40435

History | View | Annotate | Download (7 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
         * or null if an attribute with the given name does not exist.
119
         *
120
         * @param name
121
         *                         of the attribute
122
         *
123
         * @return
124
         *                 a {@link FeatureAttributeDescriptor}
125
         */
126
        public FeatureAttributeDescriptor getAttributeDescriptor(String name);
127

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
270

    
271
}