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 / FeatureType.java @ 44149
History | View | Annotate | Download (8.89 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright (C) 2007-2013 gvSIG Association.
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 3
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 40435 | jjdelcerro | package org.gvsig.fmap.dal.feature; |
25 | |||
26 | import java.util.Iterator; |
||
27 | import java.util.List; |
||
28 | |||
29 | import org.cresques.cts.IProjection; |
||
30 | |||
31 | import org.gvsig.fmap.geom.Geometry; |
||
32 | import org.gvsig.tools.dynobject.DynClass; |
||
33 | import org.gvsig.tools.evaluator.Evaluator; |
||
34 | 44149 | jjdelcerro | import org.gvsig.tools.util.UnmodifiableBasicList; |
35 | 40435 | jjdelcerro | |
36 | /**
|
||
37 | * <p>
|
||
38 | * This interface provides all the information that describes the structure of
|
||
39 | * a type of feature, methods for managing it and also offers a variety of utility
|
||
40 | * methods for simplicity's sake.
|
||
41 | * </p>
|
||
42 | *
|
||
43 | * <p>
|
||
44 | * The relevant information that compounds a FeatureType includes:
|
||
45 | * </p>
|
||
46 | *
|
||
47 | * <ul>
|
||
48 | * <li> {@link FeatureAttributeDescriptor}(s)
|
||
49 | * <li> {@link FeatureRule}(s)
|
||
50 | * <li> Its size
|
||
51 | * <li> Its SRS(s)
|
||
52 | * <li> Its identifier
|
||
53 | * <li> Whether features of this type have an OID or not (identifier assigned by the store).
|
||
54 | * </ul>
|
||
55 | *
|
||
56 | * <p>
|
||
57 | * Methods for management include:
|
||
58 | * </p>
|
||
59 | *
|
||
60 | * <ul>
|
||
61 | * <li>Obtaining its editable instance.
|
||
62 | * <li>Obtaining an iterator over its attributes.
|
||
63 | * <li>Knowing whether this FeatureType has any associated evaluator for calculated attributes.
|
||
64 | * </ul>
|
||
65 | *
|
||
66 | * <p>
|
||
67 | * Utility methods include:
|
||
68 | * </p>
|
||
69 | *
|
||
70 | * <ul>
|
||
71 | * <li>Getting a copy of the FeatureType.
|
||
72 | * <li>Getting the default geometry attribute.
|
||
73 | * <li>Getting the default spatial reference system.
|
||
74 | 44077 | jjdelcerro | * </ul>
|
75 | 40435 | jjdelcerro | */
|
76 | 44149 | jjdelcerro | public interface FeatureType extends DynClass, UnmodifiableBasicList<FeatureAttributeDescriptor> { |
77 | 40435 | jjdelcerro | |
78 | /**
|
||
79 | * Returns a new copy of this FeatureType
|
||
80 | *
|
||
81 | * @return
|
||
82 | * a new copy of this FeatureType
|
||
83 | */
|
||
84 | public FeatureType getCopy();
|
||
85 | |||
86 | /**
|
||
87 | * Returns a {@link FeatureRules} containing
|
||
88 | * all rules applicable to features of this type.
|
||
89 | *
|
||
90 | * @return
|
||
91 | * a {@link FeatureRules} containing all rules
|
||
92 | * applicable to features of this type.
|
||
93 | */
|
||
94 | public FeatureRules getRules();
|
||
95 | |||
96 | /**
|
||
97 | * Returns an editable instance of this FeatureType.
|
||
98 | * Any modifications on a FeatureType must be done
|
||
99 | * through its editable instance.
|
||
100 | *
|
||
101 | * @return
|
||
102 | * the editable instance of this FeatureType.
|
||
103 | *
|
||
104 | * @see EditableFeatureType
|
||
105 | */
|
||
106 | public EditableFeatureType getEditable();
|
||
107 | |||
108 | /**
|
||
109 | * Given the name of an attribute, this method returns
|
||
110 | * its position in this FeatureType.
|
||
111 | *
|
||
112 | * @param name
|
||
113 | * of the attribute
|
||
114 | * @return
|
||
115 | * position of the attribute
|
||
116 | */
|
||
117 | public int getIndex(String name); |
||
118 | |||
119 | /**
|
||
120 | * Returns an attribute descriptor given its name.
|
||
121 | *
|
||
122 | * @param name
|
||
123 | * of the attribute
|
||
124 | * @return
|
||
125 | * descriptor of the attribute, a {@link FeatureAttributeDescriptor}.
|
||
126 | */
|
||
127 | public Object get(String name); |
||
128 | |||
129 | /**
|
||
130 | * Returns an attribute descriptor given its index
|
||
131 | *
|
||
132 | * @param index
|
||
133 | * of the attribute
|
||
134 | *
|
||
135 | * @return
|
||
136 | * descriptor of the attribute, a {@link FeatureAttributeDescriptor}
|
||
137 | */
|
||
138 | 44149 | jjdelcerro | public FeatureAttributeDescriptor get(int index); |
139 | 40435 | jjdelcerro | |
140 | /**
|
||
141 | * Returns a {@link FeatureAttributeDescriptor} given the attribute name,
|
||
142 | * or null if an attribute with the given name does not exist.
|
||
143 | *
|
||
144 | * @param name
|
||
145 | * of the attribute
|
||
146 | *
|
||
147 | * @return
|
||
148 | * a {@link FeatureAttributeDescriptor}
|
||
149 | */
|
||
150 | public FeatureAttributeDescriptor getAttributeDescriptor(String name); |
||
151 | |||
152 | /**
|
||
153 | * Returns a {@link FeatureAttributeDescriptor} given the attribute index.
|
||
154 | *
|
||
155 | * @param index
|
||
156 | * of the attribute
|
||
157 | *
|
||
158 | * @return
|
||
159 | * a {@link FeatureAttributeDescriptor}
|
||
160 | */
|
||
161 | public FeatureAttributeDescriptor getAttributeDescriptor(int index); |
||
162 | |||
163 | /**
|
||
164 | * Returns an iterator over this FeatureType's attributes. Elements
|
||
165 | * returned by this iterator are of type {@link FeatureAttributeDescriptor}.
|
||
166 | *
|
||
167 | * @return
|
||
168 | * An iterator over this FeatureType's {@link FeatureAttributeDescriptor}s.
|
||
169 | */
|
||
170 | public Iterator iterator(); |
||
171 | |||
172 | /**
|
||
173 | * Returns this FeatureType size. The size of a FeatureType is determined
|
||
174 | * by its number of attributes.
|
||
175 | *
|
||
176 | * @return
|
||
177 | * this FeatureType size, defined as the number of attributes it is composed of.
|
||
178 | *
|
||
179 | */
|
||
180 | public int size(); |
||
181 | 44149 | jjdelcerro | |
182 | public boolean isEmpty(); |
||
183 | 40435 | jjdelcerro | |
184 | /**
|
||
185 | * Returns this FeatureType identifier. This identifier must always be equal
|
||
186 | * to a store.
|
||
187 | *
|
||
188 | * @return the identifier.
|
||
189 | */
|
||
190 | public String getId(); |
||
191 | |||
192 | /**
|
||
193 | * Returns the name of the attribute that will be used as default
|
||
194 | * geometry attribute for those processes that require a geometry (for
|
||
195 | * instance rendering).
|
||
196 | *
|
||
197 | * @return
|
||
198 | * name of the default geometry attribute.
|
||
199 | */
|
||
200 | public String getDefaultGeometryAttributeName(); |
||
201 | |||
202 | /**
|
||
203 | * Returns the index of the attribute that will be used as default
|
||
204 | * geometry attribute.
|
||
205 | *
|
||
206 | * @return
|
||
207 | * index of the default geometry attribute.
|
||
208 | */
|
||
209 | public int getDefaultGeometryAttributeIndex(); |
||
210 | |||
211 | /**
|
||
212 | * Returns a list with the SRSs in which this FeatureType geometries are
|
||
213 | * expressed. Normally there may be one SRS for each attribute of type
|
||
214 | * {@link Geometry}.
|
||
215 | *
|
||
216 | * @return
|
||
217 | * a list with the SRS in which this FeatureType geometries are expressed.
|
||
218 | */
|
||
219 | public List getSRSs(); |
||
220 | |||
221 | /**
|
||
222 | * Returns the SRS in which the default geometry attribute is expressed.
|
||
223 | *
|
||
224 | * @return
|
||
225 | * the SRS in which the default geometry attribute is expressed,
|
||
226 | * null if not has a default geometry attribute.
|
||
227 | */
|
||
228 | public IProjection getDefaultSRS();
|
||
229 | |||
230 | /**
|
||
231 | * Indicates whether this FeatureType has any assigned {@link Evaluator}(s).
|
||
232 | * Evaluators are used to obtain the values for calculated
|
||
233 | * attributes.
|
||
234 | *
|
||
235 | * @return
|
||
236 | * true if this FeatureType has any assigned {@link Evaluator}(s).
|
||
237 | */
|
||
238 | public boolean hasEvaluators(); // FIXME: Quitar del interface y dejar en DefaultFeatureType |
||
239 | |||
240 | /**
|
||
241 | * Indicates whether {@link Feature}(s) of this FeatureType have an OID defined.
|
||
242 | * An OID is the Feature unique identifier.
|
||
243 | *
|
||
244 | * Some stores provide their own OIDs which are always unique
|
||
245 | * (such as Postgre) while others don't support this concept and
|
||
246 | * then it is the library who creates runtime ad-hoc OIDs as
|
||
247 | * it see fits, but then integrity of this OIDs among different
|
||
248 | * work sessions cannot be guaranteed (this is the case for shape
|
||
249 | * files).
|
||
250 | *
|
||
251 | * @return
|
||
252 | * true if this FeatureType has an OID defined, false otherwise.
|
||
253 | *
|
||
254 | */
|
||
255 | public boolean hasOID(); |
||
256 | |||
257 | /**
|
||
258 | * Incicates if attibutes with automatic values are allowed in the source
|
||
259 | *
|
||
260 | * @return true if source supports this feature, false otherwise
|
||
261 | */
|
||
262 | public boolean allowAutomaticValues(); |
||
263 | |||
264 | /**
|
||
265 | * Returns an Array of the FeatureAttributeDescriptor
|
||
266 | *
|
||
267 | * @return
|
||
268 | */
|
||
269 | public FeatureAttributeDescriptor[] getAttributeDescriptors(); |
||
270 | |||
271 | /**
|
||
272 | * Returns an Array of the FeatureAttributeDescriptor that compounds the
|
||
273 | 43358 | jjdelcerro | * primary key. If not have primary keys return a empty array.
|
274 | 40435 | jjdelcerro | *
|
275 | * @return
|
||
276 | */
|
||
277 | public FeatureAttributeDescriptor[] getPrimaryKey(); |
||
278 | |||
279 | /**
|
||
280 | * Returns the default geometry FeatureAttributeDescriptor. Return null if
|
||
281 | * it's not set
|
||
282 | *
|
||
283 | * @return
|
||
284 | */
|
||
285 | public FeatureAttributeDescriptor getDefaultGeometryAttribute();
|
||
286 | |||
287 | /**
|
||
288 | * Returns the default time FeatureAttributeDescriptor. Return null if
|
||
289 | * it's not set.
|
||
290 | *
|
||
291 | * @return
|
||
292 | * the default time attribute
|
||
293 | */
|
||
294 | 44077 | jjdelcerro | public FeatureAttributeDescriptor getDefaultTimeAttribute();
|
295 | 40435 | jjdelcerro | |
296 | 43739 | jjdelcerro | /**
|
297 | 44077 | jjdelcerro | * Returns the name of the attribute that will be used as default
|
298 | * geometry attribute for those processes that require a geometry (for
|
||
299 | * instance rendering).
|
||
300 | *
|
||
301 | * @return
|
||
302 | * name of the default geometry attribute.
|
||
303 | */
|
||
304 | public String getDefaultTimeAttributeName(); |
||
305 | |||
306 | /**
|
||
307 | * Returns the index of the attribute that will be used as default
|
||
308 | * geometry attribute.
|
||
309 | *
|
||
310 | * @return
|
||
311 | * index of the default geometry attribute.
|
||
312 | */
|
||
313 | public int getDefaultTimeAttributeIndex(); |
||
314 | |||
315 | /**
|
||
316 | 43739 | jjdelcerro | * Return the store associated to this type.
|
317 | *
|
||
318 | * @return the FeatureStore of the type.
|
||
319 | */
|
||
320 | public FeatureStore getStore();
|
||
321 | 40435 | jjdelcerro | |
322 | } |