Statistics
| Revision:

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

History | View | Annotate | Download (9.76 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.tools.dynobject.DynObject;
11

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
339

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

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

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

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

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

    
385
        public DynObject getAsDynObject();
386

    
387
}