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