Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / FeatureType.java @ 28782

History | View | Annotate | Download (6.58 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
import org.gvsig.fmap.geom.Geometry;
8
import org.gvsig.tools.evaluator.Evaluator;
9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
234
        /**
235
         * Returns an Array of the FeatureAttributeDescriptor
236
         *
237
         * @return
238
         */
239
        public FeatureAttributeDescriptor[] getAttributeDescriptors();
240

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

    
249
        /**
250
         * Returns the default geometry FeatureAttributeDescriptor. Return null if
251
         * it's not set
252
         *
253
         * @return
254
         */
255
        public FeatureAttributeDescriptor getDefaultGeometryAttribute();
256
}