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