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 @ 43739
History | View | Annotate | Download (8.21 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 | |||
35 | /**
|
||
36 | * <p>
|
||
37 | * This interface provides all the information that describes the structure of
|
||
38 | * a type of feature, methods for managing it and also offers a variety of utility
|
||
39 | * methods for simplicity's sake.
|
||
40 | * </p>
|
||
41 | *
|
||
42 | * <p>
|
||
43 | * The relevant information that compounds a FeatureType includes:
|
||
44 | * </p>
|
||
45 | *
|
||
46 | * <ul>
|
||
47 | * <li> {@link FeatureAttributeDescriptor}(s)
|
||
48 | * <li> {@link FeatureRule}(s)
|
||
49 | * <li> Its size
|
||
50 | * <li> Its SRS(s)
|
||
51 | * <li> Its identifier
|
||
52 | * <li> Whether features of this type have an OID or not (identifier assigned by the store).
|
||
53 | * </ul>
|
||
54 | *
|
||
55 | * <p>
|
||
56 | * Methods for management include:
|
||
57 | * </p>
|
||
58 | *
|
||
59 | * <ul>
|
||
60 | * <li>Obtaining its editable instance.
|
||
61 | * <li>Obtaining an iterator over its attributes.
|
||
62 | * <li>Knowing whether this FeatureType has any associated evaluator for calculated attributes.
|
||
63 | * </ul>
|
||
64 | *
|
||
65 | * <p>
|
||
66 | * Utility methods include:
|
||
67 | * </p>
|
||
68 | *
|
||
69 | * <ul>
|
||
70 | * <li>Getting a copy of the FeatureType.
|
||
71 | * <li>Getting the default geometry attribute.
|
||
72 | * <li>Getting the default spatial reference system.
|
||
73 | * <ul/>
|
||
74 | */
|
||
75 | 42471 | jjdelcerro | public interface FeatureType extends DynClass, Iterable<FeatureAttributeDescriptor> { |
76 | 40435 | jjdelcerro | |
77 | /**
|
||
78 | * Returns a new copy of this FeatureType
|
||
79 | *
|
||
80 | * @return
|
||
81 | * a new copy of this FeatureType
|
||
82 | */
|
||
83 | public FeatureType getCopy();
|
||
84 | |||
85 | /**
|
||
86 | * Returns a {@link FeatureRules} containing
|
||
87 | * all rules applicable to features of this type.
|
||
88 | *
|
||
89 | * @return
|
||
90 | * a {@link FeatureRules} containing all rules
|
||
91 | * applicable to features of this type.
|
||
92 | */
|
||
93 | public FeatureRules getRules();
|
||
94 | |||
95 | /**
|
||
96 | * Returns an editable instance of this FeatureType.
|
||
97 | * Any modifications on a FeatureType must be done
|
||
98 | * through its editable instance.
|
||
99 | *
|
||
100 | * @return
|
||
101 | * the editable instance of this FeatureType.
|
||
102 | *
|
||
103 | * @see EditableFeatureType
|
||
104 | */
|
||
105 | public EditableFeatureType getEditable();
|
||
106 | |||
107 | /**
|
||
108 | * Given the name of an attribute, this method returns
|
||
109 | * its position in this FeatureType.
|
||
110 | *
|
||
111 | * @param name
|
||
112 | * of the attribute
|
||
113 | * @return
|
||
114 | * position of the attribute
|
||
115 | */
|
||
116 | public int getIndex(String name); |
||
117 | |||
118 | /**
|
||
119 | * Returns an attribute descriptor given its name.
|
||
120 | *
|
||
121 | * @param name
|
||
122 | * of the attribute
|
||
123 | * @return
|
||
124 | * descriptor of the attribute, a {@link FeatureAttributeDescriptor}.
|
||
125 | */
|
||
126 | public Object get(String name); |
||
127 | |||
128 | /**
|
||
129 | * Returns an attribute descriptor given its index
|
||
130 | *
|
||
131 | * @param index
|
||
132 | * of the attribute
|
||
133 | *
|
||
134 | * @return
|
||
135 | * descriptor of the attribute, a {@link FeatureAttributeDescriptor}
|
||
136 | */
|
||
137 | public Object get(int index); |
||
138 | |||
139 | /**
|
||
140 | * Returns a {@link FeatureAttributeDescriptor} given the attribute name,
|
||
141 | * or null if an attribute with the given name does not exist.
|
||
142 | *
|
||
143 | * @param name
|
||
144 | * of the attribute
|
||
145 | *
|
||
146 | * @return
|
||
147 | * a {@link FeatureAttributeDescriptor}
|
||
148 | */
|
||
149 | public FeatureAttributeDescriptor getAttributeDescriptor(String name); |
||
150 | |||
151 | /**
|
||
152 | * Returns a {@link FeatureAttributeDescriptor} given the attribute index.
|
||
153 | *
|
||
154 | * @param index
|
||
155 | * of the attribute
|
||
156 | *
|
||
157 | * @return
|
||
158 | * a {@link FeatureAttributeDescriptor}
|
||
159 | */
|
||
160 | public FeatureAttributeDescriptor getAttributeDescriptor(int index); |
||
161 | |||
162 | /**
|
||
163 | * Returns an iterator over this FeatureType's attributes. Elements
|
||
164 | * returned by this iterator are of type {@link FeatureAttributeDescriptor}.
|
||
165 | *
|
||
166 | * @return
|
||
167 | * An iterator over this FeatureType's {@link FeatureAttributeDescriptor}s.
|
||
168 | */
|
||
169 | public Iterator iterator(); |
||
170 | |||
171 | /**
|
||
172 | * Returns this FeatureType size. The size of a FeatureType is determined
|
||
173 | * by its number of attributes.
|
||
174 | *
|
||
175 | * @return
|
||
176 | * this FeatureType size, defined as the number of attributes it is composed of.
|
||
177 | *
|
||
178 | */
|
||
179 | public int size(); |
||
180 | |||
181 | /**
|
||
182 | * Returns this FeatureType identifier. This identifier must always be equal
|
||
183 | * to a store.
|
||
184 | *
|
||
185 | * @return the identifier.
|
||
186 | */
|
||
187 | public String getId(); |
||
188 | |||
189 | /**
|
||
190 | * Returns the name of the attribute that will be used as default
|
||
191 | * geometry attribute for those processes that require a geometry (for
|
||
192 | * instance rendering).
|
||
193 | *
|
||
194 | * @return
|
||
195 | * name of the default geometry attribute.
|
||
196 | */
|
||
197 | public String getDefaultGeometryAttributeName(); |
||
198 | |||
199 | /**
|
||
200 | * Returns the index of the attribute that will be used as default
|
||
201 | * geometry attribute.
|
||
202 | *
|
||
203 | * @return
|
||
204 | * index of the default geometry attribute.
|
||
205 | */
|
||
206 | public int getDefaultGeometryAttributeIndex(); |
||
207 | |||
208 | /**
|
||
209 | * Returns a list with the SRSs in which this FeatureType geometries are
|
||
210 | * expressed. Normally there may be one SRS for each attribute of type
|
||
211 | * {@link Geometry}.
|
||
212 | *
|
||
213 | * @return
|
||
214 | * a list with the SRS in which this FeatureType geometries are expressed.
|
||
215 | */
|
||
216 | public List getSRSs(); |
||
217 | |||
218 | /**
|
||
219 | * Returns the SRS in which the default geometry attribute is expressed.
|
||
220 | *
|
||
221 | * @return
|
||
222 | * the SRS in which the default geometry attribute is expressed,
|
||
223 | * null if not has a default geometry attribute.
|
||
224 | */
|
||
225 | public IProjection getDefaultSRS();
|
||
226 | |||
227 | /**
|
||
228 | * Indicates whether this FeatureType has any assigned {@link Evaluator}(s).
|
||
229 | * Evaluators are used to obtain the values for calculated
|
||
230 | * attributes.
|
||
231 | *
|
||
232 | * @return
|
||
233 | * true if this FeatureType has any assigned {@link Evaluator}(s).
|
||
234 | */
|
||
235 | public boolean hasEvaluators(); // FIXME: Quitar del interface y dejar en DefaultFeatureType |
||
236 | |||
237 | /**
|
||
238 | * Indicates whether {@link Feature}(s) of this FeatureType have an OID defined.
|
||
239 | * An OID is the Feature unique identifier.
|
||
240 | *
|
||
241 | * Some stores provide their own OIDs which are always unique
|
||
242 | * (such as Postgre) while others don't support this concept and
|
||
243 | * then it is the library who creates runtime ad-hoc OIDs as
|
||
244 | * it see fits, but then integrity of this OIDs among different
|
||
245 | * work sessions cannot be guaranteed (this is the case for shape
|
||
246 | * files).
|
||
247 | *
|
||
248 | * @return
|
||
249 | * true if this FeatureType has an OID defined, false otherwise.
|
||
250 | *
|
||
251 | */
|
||
252 | public boolean hasOID(); |
||
253 | |||
254 | /**
|
||
255 | * Incicates if attibutes with automatic values are allowed in the source
|
||
256 | *
|
||
257 | * @return true if source supports this feature, false otherwise
|
||
258 | */
|
||
259 | public boolean allowAutomaticValues(); |
||
260 | |||
261 | /**
|
||
262 | * Returns an Array of the FeatureAttributeDescriptor
|
||
263 | *
|
||
264 | * @return
|
||
265 | */
|
||
266 | public FeatureAttributeDescriptor[] getAttributeDescriptors(); |
||
267 | |||
268 | /**
|
||
269 | * Returns an Array of the FeatureAttributeDescriptor that compounds the
|
||
270 | 43358 | jjdelcerro | * primary key. If not have primary keys return a empty array.
|
271 | 40435 | jjdelcerro | *
|
272 | * @return
|
||
273 | */
|
||
274 | public FeatureAttributeDescriptor[] getPrimaryKey(); |
||
275 | |||
276 | /**
|
||
277 | * Returns the default geometry FeatureAttributeDescriptor. Return null if
|
||
278 | * it's not set
|
||
279 | *
|
||
280 | * @return
|
||
281 | */
|
||
282 | public FeatureAttributeDescriptor getDefaultGeometryAttribute();
|
||
283 | |||
284 | /**
|
||
285 | * Returns the default time FeatureAttributeDescriptor. Return null if
|
||
286 | * it's not set.
|
||
287 | *
|
||
288 | * @return
|
||
289 | * the default time attribute
|
||
290 | */
|
||
291 | public FeatureAttributeDescriptor getDefaultTimeAttribute();
|
||
292 | |||
293 | 43739 | jjdelcerro | /**
|
294 | * Return the store associated to this type.
|
||
295 | *
|
||
296 | * @return the FeatureStore of the type.
|
||
297 | */
|
||
298 | public FeatureStore getStore();
|
||
299 | 40435 | jjdelcerro | |
300 | } |