Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / Feature.java @ 33205

History | View | Annotate | Download (9.74 KB)

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

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

    
6
import org.cresques.cts.IProjection;
7
import org.gvsig.fmap.geom.Geometry;
8
import org.gvsig.fmap.geom.primitive.Envelope;
9
import org.gvsig.tools.dynobject.DynObject;
10

    
11
/**
12
 * <p>Represents the basic data unit of a tabular structure, equivalent
13
 * to a record in a data base table. In SIG domain, a Feature is a compound
14
 * data structure that may contain a geographic component. The conventional term
15
 * Feature comes from the term cartographic feature and both represent the same
16
 * concept.
17
 * </p>
18
 * <p>
19
 * A Feature may contain more than one geometry attribute. In the case there is not any geometry data,
20
 * the <code>getDefaultGeometry()</code> will return <code>null</code>.
21
 * </p>
22
 * <p>
23
 * Features are not editable as such. To edit a Feature you have to obtain an
24
 * editable instance <code>EditableFeature</code> using the method <code>getEditable()</code>.
25
 * Modify that editable instance and then apply the changes to the Feature. This
26
 * mechanism is to avoid ambiguity and loosing track on the Feature internal state.
27
 * </p>
28
 * <br>
29
 * <p>The Feature:
30
 *   <ul>
31
 *     <li>Has an unique identifier <code>FeatureReference</code>
32
 *     to recognize our Feature from each other from the same data store</li>
33
 *     <li>Has a <code>FeatureType</code> that describes the Feature characteristics (attributes,
34
 *     data types, default geometry, validation rules).</li>
35
 *     <li>Can obtain a copy of itself.</li>
36
 *     <li>Can obtain its default geometry attribute and also a list with all the geometry attributes.</li>
37
 *     <li>Can obtain its default Spatial Reference System and also a list with all the SRSs used in the geometry attributes.</li>
38
 *     <li>Can obtain the envelope (extent) of the default geometry attribute.
39
 *     <li>Can obtain the editable instance of the Feature.</li>
40
 *     <li>Has a set of utility methods to read attributes when their type is known, by both index and name.</li>
41
 *   </ul>
42
 * </p>
43
 *
44
 */
45
public interface Feature extends DynObject {
46

    
47
        /**
48
         * Returns a unique identifier for this Feature in the associated store.
49
         *
50
         * @return
51
         *                 a unique FeatureReference in the associated store
52
         */
53
        public FeatureReference getReference();
54

    
55
        /**
56
         * Returns the FeatureType that describes the structure of this Feature.
57
         *
58
         * @return
59
         *                 a FeatureType describing this Feature structure.
60
         */
61
        public FeatureType getType();
62

    
63
        /**
64
         * Creates and returns a copy of this
65
         *
66
         * @return
67
         *                 a new instance of Feature which is equal to this
68
         */
69
        public Feature getCopy();
70

    
71
        /** Mode that indicates the validation of all FeatureRules */
72
        static final int ALL = 0;
73

    
74
        /** Mode that indicates the validation of the update FeatureRules */
75
        static final int UPDATE = 1;
76

    
77
        /** Mode that indicates the validation of the finish editing FeatureRules */
78
        static final int FINISH_EDITING = 2;
79

    
80
        /**
81
         * Validates this Feature by applying the <code>FeatureRules</code>
82
         * corresponding to the given mode.
83
         *
84
         * @param mode
85
         *                         one of the constants {ALL, UPDATE, FINISH_EDITING}
86
         */
87
        public void validate(int mode);
88

    
89
        /**
90
         * Returns the editable instance of this Feature.
91
         * EditableFeature offers methods for Feature editing.
92
         *
93
         * @return
94
         *                 EditableFeature of this
95
         */
96
        public EditableFeature getEditable();
97

    
98
        /**
99
         * Returns the value of an attribute given its name.
100
         *
101
         * @param name
102
         *                         a string containing the name of the attribute
103
         * @return
104
         *                 value of the specified attribute
105
         */
106
        public Object   get(String name);
107

    
108
        /**
109
         * Returns the value of an attribute given its position.
110
         *
111
         * @param index
112
         *                         position of the attribute
113
         * @return
114
         *                 value of the specified attribute
115
         */
116
        public Object   get(int index);
117

    
118
        /**
119
         * Returns the int value of an attribute given its name.
120
         *
121
         * @param name
122
         *                         a string containing the name of the attribute
123
         * @return
124
         *                 value of the specified attribute
125
         */
126
        public int      getInt(String name);
127

    
128
        /**
129
         * Returns the int value of an attribute given its position.
130
         *
131
         * @param index
132
         *                         position of the attribute
133
         * @return
134
         *                 value of the specified attribute
135
         */
136
        public int      getInt(int index);
137

    
138
        /**
139
         * Returns the Boolean value of an attribute given its name.
140
         *
141
         * @param name
142
         *                         name of the attribute
143
         * @return
144
         *                 value of the specified attribute
145
         */
146
        public boolean  getBoolean(String name);
147

    
148
        /**
149
         * Returns the Boolean value of an attribute given its position.
150
         *
151
         * @param index
152
         *                         position of the attribute
153
         * @return
154
         *                 value of the specified attribute
155
         */
156
        public boolean  getBoolean(int index);
157

    
158
        /**
159
         * Returns the long value of an attribute given its name.
160
         *
161
         * @param name
162
         *                         name of the attribute
163
         * @return
164
         *                 value of the specified attribute
165
         */
166
        public long     getLong(String name);
167

    
168
        /**
169
         * Returns the long value of an attribute given its position.
170
         *
171
         * @param index
172
         *                         position of the attribute
173
         * @return
174
         *                 value of the specified attribute
175
         */
176
        public long     getLong(int index);
177

    
178
        /**
179
         * Returns the float value of an attribute given its name.
180
         *
181
         * @param name
182
         *                         name of the attribute
183
         * @return
184
         *                 value of the specified attribute
185
         */
186
        public float   getFloat(String name);
187

    
188
        /**
189
         * Returns the float value of an attribute given its position.
190
         *
191
         * @param index
192
         *                         position of the attribute
193
         * @return
194
         *                 value of the specified attribute
195
         */
196
        public float    getFloat(int index);
197

    
198
        /**
199
         * Returns the double value of an attribute given its name.
200
         *
201
         * @param name
202
         *                         name of the attribute
203
         * @return
204
         *                 value of the specified attribute
205
         */
206
        public double  getDouble(String name);
207

    
208
        /**
209
         * Returns the double value of an attribute given its position.
210
         *
211
         * @param index
212
         *                         position of the attribute
213
         * @return
214
         *                 value of the specified attribute
215
         */
216
        public double   getDouble(int index);
217

    
218
        /**
219
         * Returns the Date value of an attribute given its name.
220
         *
221
         * @param name
222
         *                         name of the attribute
223
         * @return
224
         *                 value of the specified attribute
225
         */
226
        public Date    getDate(String name);
227

    
228
        /**
229
         * Returns the Date value of an attribute given its position.
230
         *
231
         * @param index
232
         *                         position of the attribute
233
         * @return
234
         *                 value of the specified attribute
235
         */
236
        public Date     getDate(int index);
237

    
238
        /**
239
         * Returns the String value of an attribute given its name.
240
         *
241
         * @param name
242
         *                         name of the attribute
243
         * @return
244
         *                 value of the specified attribute
245
         */
246
        public String  getString(String name);
247

    
248
        /**
249
         * Returns the String value of an attribute given its position.
250
         *
251
         * @param index
252
         *                         position of the attribute
253
         * @return
254
         *                 value of the specified attribute
255
         */
256
        public String   getString(int index);
257

    
258
        /**
259
         * Returns the byte value of an attribute given its name.
260
         *
261
         * @param name
262
         *                         name of the attribute
263
         * @return
264
         *                 value of the specified attribute
265
         */
266
        public byte    getByte(String name);
267

    
268
        /**
269
         * Returns the byte value of an attribute given its position.
270
         *
271
         * @param index
272
         *                         position of the attribute
273
         * @return
274
         *                 value of the specified attribute
275
         */
276
        public byte     getByte(int index);
277

    
278
        /**
279
         * Returns the Geometry value of an attribute given its name.
280
         *
281
         * @param name
282
         *                         name of the attribute
283
         * @return
284
         *                 value of the specified attribute
285
         */
286
        public Geometry getGeometry(String name);
287

    
288
        /**
289
         * Returns the Geometry value of an attribute given its position.
290
         *
291
         * @param index
292
         *                         position of the attribute
293
         * @return
294
         *                 value of the specified attribute
295
         */
296
        public Geometry getGeometry(int index);
297

    
298
        /**
299
         * Returns the array value of an attribute given its name.
300
         *
301
         * @param name
302
         *                         name of the attribute
303
         * @return
304
         *                 value of the specified attribute
305
         */
306
        public Object[] getArray(String name);
307

    
308
        /**
309
         * Returns the array value of an attribute given its position.
310
         *
311
         * @param index
312
         *                         position of the attribute
313
         * @return
314
         *                 value of the specified attribute
315
         */
316
        public Object[] getArray(int index);
317

    
318
        /**
319
         * Returns the Feature value of an attribute given its name.
320
         *
321
         * @param name
322
         *                         name of the attribute
323
         * @return
324
         *                 value of the specified attribute
325
         */
326
        public Feature  getFeature(String name);
327

    
328
        /**
329
         * Returns the Feature value of an attribute given its position.
330
         *
331
         * @param index
332
         *                         position of the attribute
333
         * @return
334
         *                 value of the specified attribute
335
         */
336
        public Feature  getFeature(int index);
337

    
338

    
339
        /**
340
         * Envelope (AKA extent or bounding box) of the default
341
         * geometry attribute.
342
         *
343
         * @return Envelope
344
         *                                 of the default geometry attribute
345
         */
346
        public Envelope getDefaultEnvelope();
347

    
348
        /**
349
         * Returns the value of the default geometry attribute,
350
         * which is a {@link Geometry}.
351
         *
352
         * @return
353
         *                 value of the default geometry attribute
354
         */
355
        public Geometry getDefaultGeometry();
356

    
357
        /**
358
         * Returns a list with the values of this Feature's
359
         * geometry attributes.
360
         *
361
         * @return
362
         *                 a list with the values of this Feature's geometry attributes
363
         */
364
        public List getGeometries();
365

    
366
        /**
367
         * Returns the Spatial Reference System in which is
368
         * expressed the default geometry attribute.
369
         *
370
         * @return
371
         *                 A string containing the default geometry attribute SRS.
372
         */
373
        public IProjection getDefaultSRS();
374

    
375
        /**
376
         * Returns a list with the Spatial Reference Systems in which
377
         * are expressed this Feature's geometry attributes.
378
         *
379
         * @return
380
         *                 a list with the Spatial Reference Systems.
381
         */
382
        public List getSRSs();
383

    
384
}