root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / Feature.java @ 38533
History | View | Annotate | Download (10.9 KB)
1 | 24496 | jmvivo | package org.gvsig.fmap.dal.feature; |
---|---|---|---|
2 | 19399 | vcaballero | |
3 | import java.util.Date; |
||
4 | import java.util.List; |
||
5 | |||
6 | 26777 | jmvivo | import org.cresques.cts.IProjection; |
7 | 33657 | cordinyana | |
8 | 23214 | jmvivo | import org.gvsig.fmap.geom.Geometry; |
9 | 21174 | vcaballero | import org.gvsig.fmap.geom.primitive.Envelope; |
10 | 37297 | jpiera | import org.gvsig.timesupport.Instant; |
11 | import org.gvsig.timesupport.Interval; |
||
12 | 36721 | fdiaz | import org.gvsig.tools.dynobject.DynObject; |
13 | 37297 | jpiera | |
14 | 19399 | vcaballero | |
15 | 23329 | vacevedo | /**
|
16 | 30550 | jmvivo | * <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 | 24789 | jiyarza | * concept.
|
21 | 23329 | vacevedo | * </p>
|
22 | 24789 | jiyarza | * <p>
|
23 | 30550 | jmvivo | * 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 | 24789 | jiyarza | * </p>
|
26 | * <p>
|
||
27 | 30550 | jmvivo | * Features are not editable as such. To edit a Feature you have to obtain an
|
28 | 24789 | jiyarza | * 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 | 23329 | vacevedo | * <br>
|
33 | * <p>The Feature:
|
||
34 | * <ul>
|
||
35 | 24789 | jiyarza | * <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 | 23329 | vacevedo | * </ul>
|
46 | * </p>
|
||
47 | 23754 | jjdelcerro | *
|
48 | 23329 | vacevedo | */
|
49 | 33657 | cordinyana | public interface Feature { |
50 | 19399 | vcaballero | |
51 | 24789 | jiyarza | /**
|
52 | 30550 | jmvivo | * Returns a unique identifier for this Feature in the associated store.
|
53 | *
|
||
54 | 24789 | jiyarza | * @return
|
55 | * a unique FeatureReference in the associated store
|
||
56 | */
|
||
57 | 23842 | jjdelcerro | public FeatureReference getReference();
|
58 | 30550 | jmvivo | |
59 | 24789 | jiyarza | /**
|
60 | * Returns the FeatureType that describes the structure of this Feature.
|
||
61 | *
|
||
62 | * @return
|
||
63 | * a FeatureType describing this Feature structure.
|
||
64 | */
|
||
65 | 21045 | jmvivo | public FeatureType getType();
|
66 | 30550 | jmvivo | |
67 | 24789 | jiyarza | /**
|
68 | * Creates and returns a copy of this
|
||
69 | 30550 | jmvivo | *
|
70 | 24789 | jiyarza | * @return
|
71 | * a new instance of Feature which is equal to this
|
||
72 | */
|
||
73 | 23754 | jjdelcerro | public Feature getCopy();
|
74 | 30550 | jmvivo | |
75 | 24789 | jiyarza | /** Mode that indicates the validation of all FeatureRules */
|
76 | 23754 | jjdelcerro | static final int ALL = 0; |
77 | 30550 | jmvivo | |
78 | 24789 | jiyarza | /** Mode that indicates the validation of the update FeatureRules */
|
79 | 23754 | jjdelcerro | static final int UPDATE = 1; |
80 | 30550 | jmvivo | |
81 | 24789 | jiyarza | /** Mode that indicates the validation of the finish editing FeatureRules */
|
82 | 23754 | jjdelcerro | static final int FINISH_EDITING = 2; |
83 | 30550 | jmvivo | |
84 | 24789 | jiyarza | /**
|
85 | * Validates this Feature by applying the <code>FeatureRules</code>
|
||
86 | 30550 | jmvivo | * corresponding to the given mode.
|
87 | *
|
||
88 | 24789 | jiyarza | * @param mode
|
89 | * one of the constants {ALL, UPDATE, FINISH_EDITING}
|
||
90 | */
|
||
91 | 23754 | jjdelcerro | public void validate(int mode); |
92 | 19399 | vcaballero | |
93 | 24789 | jiyarza | /**
|
94 | * Returns the editable instance of this Feature.
|
||
95 | 25481 | jiyarza | * EditableFeature offers methods for Feature editing.
|
96 | 30550 | jmvivo | *
|
97 | 24789 | jiyarza | * @return
|
98 | * EditableFeature of this
|
||
99 | */
|
||
100 | 23754 | jjdelcerro | public EditableFeature getEditable();
|
101 | 19399 | vcaballero | |
102 | 24789 | jiyarza | /**
|
103 | * Returns the value of an attribute given its name.
|
||
104 | 30550 | jmvivo | *
|
105 | 24789 | jiyarza | * @param name
|
106 | * a string containing the name of the attribute
|
||
107 | * @return
|
||
108 | * value of the specified attribute
|
||
109 | */
|
||
110 | 23754 | jjdelcerro | public Object get(String name); |
111 | 30550 | jmvivo | |
112 | 24789 | jiyarza | /**
|
113 | * Returns the value of an attribute given its position.
|
||
114 | 30550 | jmvivo | *
|
115 | 24789 | jiyarza | * @param index
|
116 | * position of the attribute
|
||
117 | * @return
|
||
118 | * value of the specified attribute
|
||
119 | */
|
||
120 | 23754 | jjdelcerro | public Object get(int index); |
121 | 19399 | vcaballero | |
122 | 24789 | jiyarza | /**
|
123 | * Returns the int value of an attribute given its name.
|
||
124 | 30550 | jmvivo | *
|
125 | 24789 | jiyarza | * @param name
|
126 | * a string containing the name of the attribute
|
||
127 | * @return
|
||
128 | * value of the specified attribute
|
||
129 | 30550 | jmvivo | */
|
130 | 23754 | jjdelcerro | public int getInt(String name); |
131 | 30550 | jmvivo | |
132 | 24789 | jiyarza | /**
|
133 | * Returns the int value of an attribute given its position.
|
||
134 | 30550 | jmvivo | *
|
135 | 24789 | jiyarza | * @param index
|
136 | * position of the attribute
|
||
137 | * @return
|
||
138 | * value of the specified attribute
|
||
139 | 30550 | jmvivo | */
|
140 | 23754 | jjdelcerro | public int getInt(int index); |
141 | 30550 | jmvivo | |
142 | 24789 | jiyarza | /**
|
143 | * Returns the Boolean value of an attribute given its name.
|
||
144 | 30550 | jmvivo | *
|
145 | 24789 | jiyarza | * @param name
|
146 | * name of the attribute
|
||
147 | * @return
|
||
148 | * value of the specified attribute
|
||
149 | */
|
||
150 | 23754 | jjdelcerro | public boolean getBoolean(String name); |
151 | 30550 | jmvivo | |
152 | 24789 | jiyarza | /**
|
153 | * Returns the Boolean value of an attribute given its position.
|
||
154 | 30550 | jmvivo | *
|
155 | 24789 | jiyarza | * @param index
|
156 | * position of the attribute
|
||
157 | * @return
|
||
158 | * value of the specified attribute
|
||
159 | 30550 | jmvivo | */
|
160 | 23754 | jjdelcerro | public boolean getBoolean(int index); |
161 | 19399 | vcaballero | |
162 | 24789 | jiyarza | /**
|
163 | * Returns the long value of an attribute given its name.
|
||
164 | 30550 | jmvivo | *
|
165 | 24789 | jiyarza | * @param name
|
166 | * name of the attribute
|
||
167 | * @return
|
||
168 | * value of the specified attribute
|
||
169 | 30550 | jmvivo | */
|
170 | 23754 | jjdelcerro | public long getLong(String name); |
171 | 30550 | jmvivo | |
172 | 24789 | jiyarza | /**
|
173 | * Returns the long value of an attribute given its position.
|
||
174 | 30550 | jmvivo | *
|
175 | 24789 | jiyarza | * @param index
|
176 | * position of the attribute
|
||
177 | * @return
|
||
178 | * value of the specified attribute
|
||
179 | 30550 | jmvivo | */
|
180 | 23754 | jjdelcerro | public long getLong(int index); |
181 | 20412 | vcaballero | |
182 | 24789 | jiyarza | /**
|
183 | * Returns the float value of an attribute given its name.
|
||
184 | 30550 | jmvivo | *
|
185 | 24789 | jiyarza | * @param name
|
186 | * name of the attribute
|
||
187 | * @return
|
||
188 | * value of the specified attribute
|
||
189 | 30550 | jmvivo | */
|
190 | 23754 | jjdelcerro | public float getFloat(String name); |
191 | 30550 | jmvivo | |
192 | 24789 | jiyarza | /**
|
193 | * Returns the float value of an attribute given its position.
|
||
194 | 30550 | jmvivo | *
|
195 | 24789 | jiyarza | * @param index
|
196 | * position of the attribute
|
||
197 | * @return
|
||
198 | * value of the specified attribute
|
||
199 | 30550 | jmvivo | */
|
200 | 23754 | jjdelcerro | public float getFloat(int index); |
201 | 20412 | vcaballero | |
202 | 24789 | jiyarza | /**
|
203 | * Returns the double value of an attribute given its name.
|
||
204 | 30550 | jmvivo | *
|
205 | 24789 | jiyarza | * @param name
|
206 | * name of the attribute
|
||
207 | * @return
|
||
208 | * value of the specified attribute
|
||
209 | 30550 | jmvivo | */
|
210 | 23754 | jjdelcerro | public double getDouble(String name); |
211 | 30550 | jmvivo | |
212 | 24789 | jiyarza | /**
|
213 | * Returns the double value of an attribute given its position.
|
||
214 | 30550 | jmvivo | *
|
215 | 24789 | jiyarza | * @param index
|
216 | * position of the attribute
|
||
217 | * @return
|
||
218 | * value of the specified attribute
|
||
219 | 30550 | jmvivo | */
|
220 | 23754 | jjdelcerro | public double getDouble(int index); |
221 | 20412 | vcaballero | |
222 | 24789 | jiyarza | /**
|
223 | * Returns the Date value of an attribute given its name.
|
||
224 | 30550 | jmvivo | *
|
225 | 24789 | jiyarza | * @param name
|
226 | * name of the attribute
|
||
227 | * @return
|
||
228 | * value of the specified attribute
|
||
229 | 30550 | jmvivo | */
|
230 | 23754 | jjdelcerro | public Date getDate(String name); |
231 | 30550 | jmvivo | |
232 | 24789 | jiyarza | /**
|
233 | * Returns the Date value of an attribute given its position.
|
||
234 | 30550 | jmvivo | *
|
235 | 24789 | jiyarza | * @param index
|
236 | * position of the attribute
|
||
237 | * @return
|
||
238 | * value of the specified attribute
|
||
239 | 30550 | jmvivo | */
|
240 | 23754 | jjdelcerro | public Date getDate(int index); |
241 | 20412 | vcaballero | |
242 | 24789 | jiyarza | /**
|
243 | * Returns the String value of an attribute given its name.
|
||
244 | 30550 | jmvivo | *
|
245 | 24789 | jiyarza | * @param name
|
246 | * name of the attribute
|
||
247 | * @return
|
||
248 | * value of the specified attribute
|
||
249 | 30550 | jmvivo | */
|
250 | 23754 | jjdelcerro | public String getString(String name); |
251 | 30550 | jmvivo | |
252 | 24789 | jiyarza | /**
|
253 | * Returns the String value of an attribute given its position.
|
||
254 | 30550 | jmvivo | *
|
255 | 24789 | jiyarza | * @param index
|
256 | * position of the attribute
|
||
257 | * @return
|
||
258 | * value of the specified attribute
|
||
259 | 30550 | jmvivo | */
|
260 | 23754 | jjdelcerro | public String getString(int index); |
261 | 19399 | vcaballero | |
262 | 24789 | jiyarza | /**
|
263 | * Returns the byte value of an attribute given its name.
|
||
264 | 30550 | jmvivo | *
|
265 | 24789 | jiyarza | * @param name
|
266 | * name of the attribute
|
||
267 | * @return
|
||
268 | * value of the specified attribute
|
||
269 | 30550 | jmvivo | */
|
270 | 23754 | jjdelcerro | public byte getByte(String name); |
271 | 30550 | jmvivo | |
272 | 24789 | jiyarza | /**
|
273 | * Returns the byte value of an attribute given its position.
|
||
274 | 30550 | jmvivo | *
|
275 | 24789 | jiyarza | * @param index
|
276 | * position of the attribute
|
||
277 | * @return
|
||
278 | * value of the specified attribute
|
||
279 | 30550 | jmvivo | */
|
280 | 23754 | jjdelcerro | public byte getByte(int index); |
281 | 19399 | vcaballero | |
282 | 24789 | jiyarza | /**
|
283 | * Returns the Geometry value of an attribute given its name.
|
||
284 | 30550 | jmvivo | *
|
285 | 24789 | jiyarza | * @param name
|
286 | * name of the attribute
|
||
287 | * @return
|
||
288 | * value of the specified attribute
|
||
289 | */
|
||
290 | 23754 | jjdelcerro | public Geometry getGeometry(String name); |
291 | 30550 | jmvivo | |
292 | 24789 | jiyarza | /**
|
293 | * Returns the Geometry value of an attribute given its position.
|
||
294 | 30550 | jmvivo | *
|
295 | 24789 | jiyarza | * @param index
|
296 | * position of the attribute
|
||
297 | * @return
|
||
298 | * value of the specified attribute
|
||
299 | 30550 | jmvivo | */
|
300 | 23754 | jjdelcerro | public Geometry getGeometry(int index); |
301 | 19399 | vcaballero | |
302 | 24789 | jiyarza | /**
|
303 | * Returns the array value of an attribute given its name.
|
||
304 | 30550 | jmvivo | *
|
305 | 24789 | jiyarza | * @param name
|
306 | * name of the attribute
|
||
307 | * @return
|
||
308 | * value of the specified attribute
|
||
309 | */
|
||
310 | 23754 | jjdelcerro | public Object[] getArray(String name); |
311 | 30550 | jmvivo | |
312 | 24789 | jiyarza | /**
|
313 | * Returns the array value of an attribute given its position.
|
||
314 | 30550 | jmvivo | *
|
315 | 24789 | jiyarza | * @param index
|
316 | * position of the attribute
|
||
317 | * @return
|
||
318 | * value of the specified attribute
|
||
319 | 30550 | jmvivo | */
|
320 | 23754 | jjdelcerro | public Object[] getArray(int index); |
321 | 19399 | vcaballero | |
322 | 24789 | jiyarza | /**
|
323 | * Returns the Feature value of an attribute given its name.
|
||
324 | 30550 | jmvivo | *
|
325 | 24789 | jiyarza | * @param name
|
326 | * name of the attribute
|
||
327 | * @return
|
||
328 | * value of the specified attribute
|
||
329 | 30550 | jmvivo | */
|
330 | 23754 | jjdelcerro | public Feature getFeature(String name); |
331 | 30550 | jmvivo | |
332 | 24789 | jiyarza | /**
|
333 | * Returns the Feature value of an attribute given its position.
|
||
334 | 30550 | jmvivo | *
|
335 | 24789 | jiyarza | * @param index
|
336 | * position of the attribute
|
||
337 | * @return
|
||
338 | * value of the specified attribute
|
||
339 | 30550 | jmvivo | */
|
340 | 23754 | jjdelcerro | public Feature getFeature(int index); |
341 | 19399 | vcaballero | |
342 | 23754 | jjdelcerro | |
343 | 23329 | vacevedo | /**
|
344 | 30550 | jmvivo | * Envelope (AKA extent or bounding box) of the default
|
345 | 24789 | jiyarza | * geometry attribute.
|
346 | 23754 | jjdelcerro | *
|
347 | * @return Envelope
|
||
348 | 24789 | jiyarza | * of the default geometry attribute
|
349 | 23329 | vacevedo | */
|
350 | 23754 | jjdelcerro | public Envelope getDefaultEnvelope();
|
351 | 19399 | vcaballero | |
352 | 24789 | jiyarza | /**
|
353 | * Returns the value of the default geometry attribute,
|
||
354 | * which is a {@link Geometry}.
|
||
355 | 30550 | jmvivo | *
|
356 | 24789 | jiyarza | * @return
|
357 | * value of the default geometry attribute
|
||
358 | */
|
||
359 | 23754 | jjdelcerro | public Geometry getDefaultGeometry();
|
360 | 30550 | jmvivo | |
361 | 24789 | jiyarza | /**
|
362 | 30550 | jmvivo | * Returns a list with the values of this Feature's
|
363 | 24789 | jiyarza | * geometry attributes.
|
364 | 30550 | jmvivo | *
|
365 | 24789 | jiyarza | * @return
|
366 | * a list with the values of this Feature's geometry attributes
|
||
367 | */
|
||
368 | 23754 | jjdelcerro | public List getGeometries(); |
369 | |||
370 | 24789 | jiyarza | /**
|
371 | 30550 | jmvivo | * Returns the Spatial Reference System in which is
|
372 | 24789 | jiyarza | * expressed the default geometry attribute.
|
373 | 30550 | jmvivo | *
|
374 | 24789 | jiyarza | * @return
|
375 | * A string containing the default geometry attribute SRS.
|
||
376 | */
|
||
377 | 26777 | jmvivo | public IProjection getDefaultSRS();
|
378 | 30550 | jmvivo | |
379 | 24789 | jiyarza | /**
|
380 | * Returns a list with the Spatial Reference Systems in which
|
||
381 | * are expressed this Feature's geometry attributes.
|
||
382 | 30550 | jmvivo | *
|
383 | 24789 | jiyarza | * @return
|
384 | * a list with the Spatial Reference Systems.
|
||
385 | */
|
||
386 | 23754 | jjdelcerro | public List getSRSs(); |
387 | 37297 | jpiera | |
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 | 23754 | jjdelcerro | |
398 | 37297 | jpiera | /**
|
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 | 36721 | fdiaz | public DynObject getAsDynObject();
|
429 | 19399 | vcaballero | } |