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