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 24496 jmvivo
package org.gvsig.fmap.dal.feature;
2 19399 vcaballero
3 23754 jjdelcerro
import java.util.Iterator;
4 19399 vcaballero
import java.util.List;
5
6 26717 jmvivo
import org.cresques.cts.IProjection;
7 33390 cordinyana
8 25458 jiyarza
import org.gvsig.fmap.geom.Geometry;
9 33390 cordinyana
import org.gvsig.tools.dynobject.DynClass;
10 25458 jiyarza
import org.gvsig.tools.evaluator.Evaluator;
11 19399 vcaballero
12 25458 jiyarza
/**
13
 * <p>
14 27262 jmvivo
 * 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 25458 jiyarza
 * methods for simplicity's sake.
17
 * </p>
18 27262 jmvivo
 *
19 25458 jiyarza
 * <p>
20
 * The relevant information that compounds a FeatureType includes:
21
 * </p>
22 27262 jmvivo
 *
23 25458 jiyarza
 *  <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 25530 jiyarza
 *  <li> Whether features of this type have an OID or not (identifier assigned by the store).
30 25458 jiyarza
 * </ul>
31 27262 jmvivo
 *
32 25458 jiyarza
 * <p>
33
 * Methods for management include:
34
 * </p>
35 27262 jmvivo
 *
36 25458 jiyarza
 *  <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 27262 jmvivo
 *
42 25458 jiyarza
 * <p>
43
 * Utility methods include:
44
 * </p>
45 27262 jmvivo
 *
46 25458 jiyarza
 * <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 33390 cordinyana
public interface FeatureType extends DynClass {
53 20599 jmvivo
54 25458 jiyarza
        /**
55
         * Returns a new copy of this FeatureType
56 27262 jmvivo
         *
57 25458 jiyarza
         * @return
58
         *                 a new copy of this FeatureType
59
         */
60 23754 jjdelcerro
        public FeatureType getCopy();
61 19399 vcaballero
62 25458 jiyarza
        /**
63
         * Returns a {@link FeatureRules} containing
64
         * all rules applicable to features of this type.
65 27262 jmvivo
         *
66 25458 jiyarza
         * @return
67 27262 jmvivo
         *                 a {@link FeatureRules} containing all rules
68 25458 jiyarza
         *                 applicable to features of this type.
69
         */
70 23754 jjdelcerro
        public FeatureRules getRules();
71 19399 vcaballero
72 25458 jiyarza
        /**
73
         * Returns an editable instance of this FeatureType.
74
         * Any modifications on a FeatureType must be done
75
         * through its editable instance.
76 27262 jmvivo
         *
77 25458 jiyarza
         * @return
78
         *                 the editable instance of this FeatureType.
79 27262 jmvivo
         *
80 25458 jiyarza
         * @see EditableFeatureType
81
         */
82 23754 jjdelcerro
        public EditableFeatureType getEditable();
83 19399 vcaballero
84 25458 jiyarza
        /**
85 27262 jmvivo
         * Given the name of an attribute, this method returns
86 25458 jiyarza
         * its position in this FeatureType.
87 27262 jmvivo
         *
88 25458 jiyarza
         * @param name
89
         *                         of the attribute
90
         * @return
91
         *                 position of the attribute
92
         */
93 23754 jjdelcerro
        public int getIndex(String name);
94 19399 vcaballero
95 25458 jiyarza
        /**
96
         * Returns an attribute descriptor given its name.
97 27262 jmvivo
         *
98 25458 jiyarza
         * @param name
99
         *                         of the attribute
100
         * @return
101
         *                 descriptor of the attribute, a {@link FeatureAttributeDescriptor}.
102
         */
103 23754 jjdelcerro
        public Object get(String name);
104 20907 jmvivo
105 25458 jiyarza
        /**
106
         * Returns an attribute descriptor given its index
107 27262 jmvivo
         *
108 25458 jiyarza
         * @param index
109
         *                         of the attribute
110 27262 jmvivo
         *
111 25458 jiyarza
         * @return
112
         *                 descriptor of the attribute, a {@link FeatureAttributeDescriptor}
113
         */
114 23754 jjdelcerro
        public Object get(int index);
115 19399 vcaballero
116 25458 jiyarza
        /**
117
         * Returns a {@link FeatureAttributeDescriptor} given the attribute name.
118 27262 jmvivo
         *
119 25458 jiyarza
         * @param name
120
         *                         of the attribute
121 27262 jmvivo
         *
122 25458 jiyarza
         * @return
123
         *                 a {@link FeatureAttributeDescriptor}
124
         */
125 23754 jjdelcerro
        public FeatureAttributeDescriptor getAttributeDescriptor(String name);
126 19399 vcaballero
127 25458 jiyarza
        /**
128
         * Returns a {@link FeatureAttributeDescriptor} given the attribute index.
129 27262 jmvivo
         *
130 25458 jiyarza
         * @param index
131
         *                         of the attribute
132 27262 jmvivo
         *
133 25458 jiyarza
         * @return
134
         *                 a {@link FeatureAttributeDescriptor}
135
         */
136 23754 jjdelcerro
        public FeatureAttributeDescriptor getAttributeDescriptor(int index);
137 19399 vcaballero
138 25458 jiyarza
        /**
139
         * Returns an iterator over this FeatureType's attributes. Elements
140
         * returned by this iterator are of type {@link FeatureAttributeDescriptor}.
141 27262 jmvivo
         *
142 25458 jiyarza
         * @return
143
         *                 An iterator over this FeatureType's {@link FeatureAttributeDescriptor}s.
144
         */
145 23754 jjdelcerro
        public Iterator iterator();
146 19608 jmvivo
147 25458 jiyarza
        /**
148
         * Returns this FeatureType size. The size of a FeatureType is determined
149
         * by its number of attributes.
150 27262 jmvivo
         *
151 25458 jiyarza
         * @return
152
         *                 this FeatureType size, defined as the number of attributes it is composed of.
153 27262 jmvivo
         *
154 25458 jiyarza
         */
155 23754 jjdelcerro
        public int size();
156 19692 jmvivo
157 25458 jiyarza
        /**
158 27262 jmvivo
         * Returns this FeatureType identifier. This identifier must always be equal
159
         * to a store.
160
         *
161
         * @return the identifier.
162 25458 jiyarza
         */
163 23772 jjdelcerro
        public String getId();
164 21120 jmvivo
165 25458 jiyarza
        /**
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 27262 jmvivo
         *
170 25458 jiyarza
         * @return
171
         *                 name of the default geometry attribute.
172
         */
173 23754 jjdelcerro
        public String getDefaultGeometryAttributeName();
174 20412 vcaballero
175 25458 jiyarza
        /**
176
         * Returns the index of the attribute that will be used as default
177
         * geometry attribute.
178 27262 jmvivo
         *
179 25458 jiyarza
         * @return
180
         *                 index of the default geometry attribute.
181
         */
182 23754 jjdelcerro
        public int getDefaultGeometryAttributeIndex();
183 23123 jmvivo
184 25458 jiyarza
        /**
185 27262 jmvivo
         * 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 25458 jiyarza
         * {@link Geometry}.
188 27262 jmvivo
         *
189 25458 jiyarza
         * @return
190
         *                 a list with the SRS in which this FeatureType geometries are expressed.
191
         */
192 23754 jjdelcerro
        public List getSRSs();
193
194 25458 jiyarza
        /**
195
         * Returns the SRS in which the default geometry attribute is expressed.
196 27262 jmvivo
         *
197 25458 jiyarza
         * @return
198 32880 jjdelcerro
         *                 the SRS in which the default geometry attribute is expressed,
199
         *      null if not has a default geometry attribute.
200 25458 jiyarza
         */
201 26717 jmvivo
        public IProjection getDefaultSRS();
202 23754 jjdelcerro
203 25458 jiyarza
        /**
204
         * Indicates whether this FeatureType has any assigned {@link Evaluator}(s).
205 27262 jmvivo
         * Evaluators are used to obtain the values for calculated
206 25458 jiyarza
         * attributes.
207 27262 jmvivo
         *
208 25458 jiyarza
         * @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 23754 jjdelcerro
213 25458 jiyarza
        /**
214 27262 jmvivo
         * 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 25458 jiyarza
         * files).
223 27262 jmvivo
         *
224 25458 jiyarza
         * @return
225
         *                 true if this FeatureType has an OID defined, false otherwise.
226 27262 jmvivo
         *
227 25458 jiyarza
         */
228 24248 jjdelcerro
        public boolean hasOID();
229
230 27439 jmvivo
        /**
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 28325 jmvivo
        /**
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 37297 jpiera
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 19399 vcaballero
}