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