Statistics
| Revision:

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

History | View | Annotate | Download (10.9 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

    
8
import org.gvsig.fmap.geom.Geometry;
9
import org.gvsig.fmap.geom.primitive.Envelope;
10
import org.gvsig.timesupport.Instant;
11
import org.gvsig.timesupport.Interval;
12
import org.gvsig.tools.dynobject.DynObject;
13

    
14

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

    
51
        /**
52
         * Returns a unique identifier for this Feature in the associated store.
53
         *
54
         * @return
55
         *                 a unique FeatureReference in the associated store
56
         */
57
        public FeatureReference getReference();
58

    
59
        /**
60
         * Returns the FeatureType that describes the structure of this Feature.
61
         *
62
         * @return
63
         *                 a FeatureType describing this Feature structure.
64
         */
65
        public FeatureType getType();
66

    
67
        /**
68
         * Creates and returns a copy of this
69
         *
70
         * @return
71
         *                 a new instance of Feature which is equal to this
72
         */
73
        public Feature getCopy();
74

    
75
        /** Mode that indicates the validation of all FeatureRules */
76
        static final int ALL = 0;
77

    
78
        /** Mode that indicates the validation of the update FeatureRules */
79
        static final int UPDATE = 1;
80

    
81
        /** Mode that indicates the validation of the finish editing FeatureRules */
82
        static final int FINISH_EDITING = 2;
83

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

    
93
        /**
94
         * Returns the editable instance of this Feature.
95
         * EditableFeature offers methods for Feature editing.
96
         *
97
         * @return
98
         *                 EditableFeature of this
99
         */
100
        public EditableFeature getEditable();
101

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

    
112
        /**
113
         * Returns the value of an attribute given its position.
114
         *
115
         * @param index
116
         *                         position of the attribute
117
         * @return
118
         *                 value of the specified attribute
119
         */
120
        public Object   get(int index);
121

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

    
132
        /**
133
         * Returns the int value of an attribute given its position.
134
         *
135
         * @param index
136
         *                         position of the attribute
137
         * @return
138
         *                 value of the specified attribute
139
         */
140
        public int      getInt(int index);
141

    
142
        /**
143
         * Returns the Boolean value of an attribute given its name.
144
         *
145
         * @param name
146
         *                         name of the attribute
147
         * @return
148
         *                 value of the specified attribute
149
         */
150
        public boolean  getBoolean(String name);
151

    
152
        /**
153
         * Returns the Boolean value of an attribute given its position.
154
         *
155
         * @param index
156
         *                         position of the attribute
157
         * @return
158
         *                 value of the specified attribute
159
         */
160
        public boolean  getBoolean(int index);
161

    
162
        /**
163
         * Returns the long value of an attribute given its name.
164
         *
165
         * @param name
166
         *                         name of the attribute
167
         * @return
168
         *                 value of the specified attribute
169
         */
170
        public long     getLong(String name);
171

    
172
        /**
173
         * Returns the long value of an attribute given its position.
174
         *
175
         * @param index
176
         *                         position of the attribute
177
         * @return
178
         *                 value of the specified attribute
179
         */
180
        public long     getLong(int index);
181

    
182
        /**
183
         * Returns the float value of an attribute given its name.
184
         *
185
         * @param name
186
         *                         name of the attribute
187
         * @return
188
         *                 value of the specified attribute
189
         */
190
        public float   getFloat(String name);
191

    
192
        /**
193
         * Returns the float value of an attribute given its position.
194
         *
195
         * @param index
196
         *                         position of the attribute
197
         * @return
198
         *                 value of the specified attribute
199
         */
200
        public float    getFloat(int index);
201

    
202
        /**
203
         * Returns the double value of an attribute given its name.
204
         *
205
         * @param name
206
         *                         name of the attribute
207
         * @return
208
         *                 value of the specified attribute
209
         */
210
        public double  getDouble(String name);
211

    
212
        /**
213
         * Returns the double value of an attribute given its position.
214
         *
215
         * @param index
216
         *                         position of the attribute
217
         * @return
218
         *                 value of the specified attribute
219
         */
220
        public double   getDouble(int index);
221

    
222
        /**
223
         * Returns the Date value of an attribute given its name.
224
         *
225
         * @param name
226
         *                         name of the attribute
227
         * @return
228
         *                 value of the specified attribute
229
         */
230
        public Date    getDate(String name);
231

    
232
        /**
233
         * Returns the Date value of an attribute given its position.
234
         *
235
         * @param index
236
         *                         position of the attribute
237
         * @return
238
         *                 value of the specified attribute
239
         */
240
        public Date     getDate(int index);
241

    
242
        /**
243
         * Returns the String value of an attribute given its name.
244
         *
245
         * @param name
246
         *                         name of the attribute
247
         * @return
248
         *                 value of the specified attribute
249
         */
250
        public String  getString(String name);
251

    
252
        /**
253
         * Returns the String value of an attribute given its position.
254
         *
255
         * @param index
256
         *                         position of the attribute
257
         * @return
258
         *                 value of the specified attribute
259
         */
260
        public String   getString(int index);
261

    
262
        /**
263
         * Returns the byte value of an attribute given its name.
264
         *
265
         * @param name
266
         *                         name of the attribute
267
         * @return
268
         *                 value of the specified attribute
269
         */
270
        public byte    getByte(String name);
271

    
272
        /**
273
         * Returns the byte value of an attribute given its position.
274
         *
275
         * @param index
276
         *                         position of the attribute
277
         * @return
278
         *                 value of the specified attribute
279
         */
280
        public byte     getByte(int index);
281

    
282
        /**
283
         * Returns the Geometry value of an attribute given its name.
284
         *
285
         * @param name
286
         *                         name of the attribute
287
         * @return
288
         *                 value of the specified attribute
289
         */
290
        public Geometry getGeometry(String name);
291

    
292
        /**
293
         * Returns the Geometry value of an attribute given its position.
294
         *
295
         * @param index
296
         *                         position of the attribute
297
         * @return
298
         *                 value of the specified attribute
299
         */
300
        public Geometry getGeometry(int index);
301

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

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

    
322
        /**
323
         * Returns the Feature value of an attribute given its name.
324
         *
325
         * @param name
326
         *                         name of the attribute
327
         * @return
328
         *                 value of the specified attribute
329
         */
330
        public Feature  getFeature(String name);
331

    
332
        /**
333
         * Returns the Feature value of an attribute given its position.
334
         *
335
         * @param index
336
         *                         position of the attribute
337
         * @return
338
         *                 value of the specified attribute
339
         */
340
        public Feature  getFeature(int index);
341

    
342

    
343
        /**
344
         * Envelope (AKA extent or bounding box) of the default
345
         * geometry attribute.
346
         *
347
         * @return Envelope
348
         *                                 of the default geometry attribute
349
         */
350
        public Envelope getDefaultEnvelope();
351

    
352
        /**
353
         * Returns the value of the default geometry attribute,
354
         * which is a {@link Geometry}.
355
         *
356
         * @return
357
         *                 value of the default geometry attribute
358
         */
359
        public Geometry getDefaultGeometry();
360

    
361
        /**
362
         * Returns a list with the values of this Feature's
363
         * geometry attributes.
364
         *
365
         * @return
366
         *                 a list with the values of this Feature's geometry attributes
367
         */
368
        public List getGeometries();
369

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

    
379
        /**
380
         * Returns a list with the Spatial Reference Systems in which
381
         * are expressed this Feature's geometry attributes.
382
         *
383
         * @return
384
         *                 a list with the Spatial Reference Systems.
385
         */
386
        public List getSRSs();
387
        
388
        /**
389
     * Returns the instant value of an attribute given its position.
390
     *
391
     * @param index
392
     *          position of the attribute
393
     * @return
394
     *      value of the specified attribute
395
     */
396
        public Instant getInstant(int index);
397

    
398
        /**
399
     * Returns the instant value of an attribute given its name.
400
     *
401
     * @param name
402
     *          a string containing the name of the attribute
403
     * @return
404
     *      value of the specified attribute
405
     */
406
        public Instant getInstant(String name);
407

    
408
    /**
409
     * Returns the interval value of an attribute given its position.
410
     *
411
     * @param index
412
     *          position of the attribute
413
     * @return
414
     *      value of the specified attribute
415
     */
416
        public Interval getInterval(int index);
417

    
418
        /**
419
     * Returns the interval value of an attribute given its name.
420
     *
421
     * @param name
422
     *          a string containing the name of the attribute
423
     * @return
424
     *      value of the specified attribute
425
     */
426
        public Interval getInterval(String name);
427

    
428
        public DynObject getAsDynObject();
429
}