Statistics
| Revision:

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 / FeatureQuery.java @ 40559

History | View | Annotate | Download (6.63 KB)

1
/**
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
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2008 {DiSiD Technologies}  {Create Parameter object to define FeatureCollections queries}
27
 */
28
package org.gvsig.fmap.dal.feature;
29

    
30
import org.gvsig.fmap.dal.DataQuery;
31
import org.gvsig.tools.evaluator.Evaluator;
32
import org.gvsig.tools.lang.Cloneable;
33

    
34
/**
35
 * Defines the properties of a collection of Features, as a result of a query
36
 * through a FeatureStore.
37
 * <p>
38
 * A FeatureQuery is always defined by a FeatureType, or by the list of
39
 * attribute names of the FeatureStore to return.
40
 * </p>
41
 * <p>
42
 * The filter allows to select Features whose properties have values with the
43
 * characteristics defined by the filter.
44
 * </p>
45
 * <p>
46
 * The order is used to set the order of the result FeatureCollection, based on
47
 * the values of the properties of the Features.
48
 * </p>
49
 * <p>
50
 * The scale parameter can be used by the FeatureStore as a hint about the
51
 * quality or resolution of the data needed to view or operate with the data
52
 * returned. As an example, the FeatureStore may use the scale to return only a
53
 * representative subset of the data, or maybe to return Features with less
54
 * detail, like a point or a line instead of a polygon.
55
 * </p>
56
 * <p>
57
 * If an implementation of FeatureStore is able to get other parameters to
58
 * customize the behavior of the getDataCollection methods, there is an option
59
 * to set more parameters through the setAttribute method.
60
 * </p>
61
 * 
62
 * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
63
 */
64
public interface FeatureQuery extends DataQuery, Cloneable {
65

    
66
        /**
67
         * Returns the names of the attributes to load from each {@link Feature}.
68
         * 
69
         * @return the attribute names to load
70
         */
71
        String[] getAttributeNames();
72

    
73
        /**
74
         * Sets the names of the attributes to load from each {@link Feature}.
75
         * 
76
         * @param attributeNames
77
         *            the attribute names to load
78
         */
79
        void setAttributeNames(String[] attributeNames);
80
        
81
        /**
82
         * Adds the name of an attribute that has to be used to load each
83
         * {@link Feature}.
84
         * 
85
         * @param attributeName
86
         *             the attribute name to load
87
         */
88
        void addAttributeName(String attributeName);
89

    
90
        /**
91
         * Sets the {@link FeatureType} of the {@link Feature}s to load. It may be
92
         * used as an alternative way to set a subset of the list of attribute names
93
         * to load, by creating a sub-FeatureType.
94
         * 
95
         * @param featureType
96
         *            the feature type of the data to load
97
         */
98
        void setFeatureType(FeatureType featureType);
99

    
100
        /**
101
         * Returns the {@link FeatureType} id of the {@link Feature}s to load.
102
         * 
103
         * @return the {@link FeatureType} id of the {@link Feature}s to load
104
         */
105
        String getFeatureTypeId();
106

    
107
        /**
108
         * Sets the {@link FeatureType} id of the {@link Feature}s to load. This way
109
         * all {@link Feature} attributes will be loaded.
110
         * 
111
         * @param featureTypeId
112
         *            the {@link FeatureType} id of the {@link Feature}s to load
113
         */
114
        void setFeatureTypeId(String featureTypeId);
115

    
116
        /**
117
         * Returns the filter to apply to the {@link Feature}s to load.
118
         * 
119
         * @return the filter
120
         */
121
        Evaluator getFilter();
122

    
123
        /**
124
         * Sets the filter to apply to the {@link Feature}s to load.
125
         * 
126
         * @param filter
127
         *            the filter to apply to the {@link Feature}s to load
128
         */
129
        void setFilter(Evaluator filter);
130
        
131
        /**
132
         * Adds a filter to apply to the {@link Feature}s to load. A query
133
         * can have more that one filter and all of them are applied when
134
         * the query is applied.
135
         * 
136
         * @param filter
137
         *             a filter to apply to the {@link Feature}s to load
138
         */
139
        void addFilter(Evaluator filter);
140

    
141
        /**
142
         * Returns if a filter has been defined for the query.
143
         * 
144
         * @return if a filter has been defined for the query
145
         */
146
        boolean hasFilter();
147

    
148
        /**
149
         * Returns the order of the {@link Feature}s to load.
150
         * 
151
         * @return the order of the {@link Feature}s to load
152
         */
153
        FeatureQueryOrder getOrder();
154

    
155
        /**
156
         * Sets the order of the {@link Feature}s to load.
157
         * 
158
         * @param order
159
         *            the order of the {@link Feature}s to load
160
         */
161
        void setOrder(FeatureQueryOrder order);
162

    
163
        /**
164
         * Returns if an order has been set for the elements returned by the query.
165
         * 
166
         * @return if an order has been set for the elements returned by the query
167
         */
168
        boolean hasOrder();
169

    
170
        /**
171
         * @deprecated to be removed in gvSIG 2.0
172
         * @see #clone()
173
         */
174
        FeatureQuery getCopy();
175

    
176
        /**
177
         * Returns the maximum number of elements to return with this query.
178
         * <p>
179
         * <strong>NOTE:</strong> this value may be ignored by the underlying data
180
         * source, or only used as a hint, so don't rely on it being used, as you
181
         * may actually get more values than the limit.
182
         * </p>
183
         * 
184
         * @return the maximum number of elements to return with this query
185
         */
186
        long getLimit();
187

    
188
        /**
189
         * Sets the maximum number of elements to return with this query.
190
         * <p>
191
         * <strong>NOTE:</strong> this value may be ignored by the underlying data
192
         * source, or only used as a hint, so don't rely on it being used, as you
193
         * may actually get more values than the limit.
194
         * </p>
195
         * 
196
         * @param limit
197
         *            the maximum number of elements to return with this query
198
         */
199
        void setLimit(long limit);
200

    
201
        /**
202
         * Returns the load page size, as the number of elements to be retrieved in
203
         * block by the data source. This value is only used as a hint to the
204
         * underlying data source, as a way to tell how many Features may be read in
205
         * a block.
206
         * 
207
         * @return the load page size
208
         */
209
        long getPageSize();
210

    
211
        /**
212
         * Sets the load page size, as the number of elements to be retrieved in
213
         * block by the data source. This value is only used as a hint to the
214
         * underlying data source, as a way to tell how many Features may be read in
215
         * a block.
216
         * 
217
         * @param pageSize
218
         *            the load page size
219
         */
220
        void setPageSize(long pageSize);
221
}