svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / main / java / org / gvsig / fmap / mapcontext / layers / vectorial / SpatialEvaluatorsFactory.java @ 43088
History | View | Annotate | Download (11.7 KB)
1 | 43020 | jjdelcerro | package org.gvsig.fmap.mapcontext.layers.vectorial; |
---|---|---|---|
2 | |||
3 | import org.cresques.cts.IProjection; |
||
4 | 43040 | jjdelcerro | import org.gvsig.fmap.dal.DALLocator; |
5 | import org.gvsig.fmap.dal.DataManager; |
||
6 | 43020 | jjdelcerro | import org.gvsig.fmap.dal.exception.DataException; |
7 | import org.gvsig.fmap.dal.feature.FeatureStore; |
||
8 | import org.gvsig.fmap.dal.feature.FeatureType; |
||
9 | import org.gvsig.fmap.dal.ExpressionBuilder; |
||
10 | import org.gvsig.fmap.geom.Geometry; |
||
11 | import org.gvsig.fmap.geom.primitive.Envelope; |
||
12 | import org.gvsig.tools.evaluator.Evaluator; |
||
13 | |||
14 | public class SpatialEvaluatorsFactory { |
||
15 | |||
16 | private static final SpatialEvaluatorsFactory factory = new SpatialEvaluatorsFactory(); |
||
17 | |||
18 | public static SpatialEvaluatorsFactory getInstance() { |
||
19 | return factory;
|
||
20 | } |
||
21 | |||
22 | private SpatialEvaluatorsFactory() {
|
||
23 | |||
24 | } |
||
25 | |||
26 | 43040 | jjdelcerro | public ExpressionBuilder createBuilder() {
|
27 | DataManager manager = DALLocator.getDataManager(); |
||
28 | ExpressionBuilder builder = manager.createExpressionBuilder(); |
||
29 | return builder;
|
||
30 | } |
||
31 | |||
32 | 43034 | jjdelcerro | public Evaluator intersects(
|
33 | Geometry geometry, |
||
34 | IProjection projection, |
||
35 | FeatureType featureType, |
||
36 | String geomName,
|
||
37 | ExpressionBuilder builder |
||
38 | ) { |
||
39 | 43020 | jjdelcerro | return new IntersectsGeometryEvaluator(geometry, projection, featureType, geomName, builder); |
40 | } |
||
41 | |||
42 | 43034 | jjdelcerro | public Evaluator intersects(
|
43 | Envelope envelope, |
||
44 | IProjection projection, |
||
45 | FeatureType featureType, |
||
46 | String geomName,
|
||
47 | ExpressionBuilder builder |
||
48 | ) { |
||
49 | 43020 | jjdelcerro | return new IntersectsEnvelopeEvaluator(envelope, projection, featureType, geomName, builder); |
50 | } |
||
51 | |||
52 | 43034 | jjdelcerro | public Evaluator intersects(
|
53 | Geometry geometry, |
||
54 | IProjection projection, |
||
55 | FeatureStore store |
||
56 | ) { |
||
57 | 43020 | jjdelcerro | try {
|
58 | FeatureType featureType = store.getDefaultFeatureType(); |
||
59 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
60 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
61 | 43020 | jjdelcerro | return intersects(geometry, projection, featureType, geomName,builder);
|
62 | } catch (DataException ex) {
|
||
63 | throw new RuntimeException("Can't create intersects evaluator.",ex); |
||
64 | } |
||
65 | } |
||
66 | |||
67 | 43034 | jjdelcerro | public Evaluator intersects(
|
68 | Envelope envelope, |
||
69 | IProjection projection, |
||
70 | FeatureStore store |
||
71 | ) { |
||
72 | 43020 | jjdelcerro | try {
|
73 | FeatureType featureType = store.getDefaultFeatureType(); |
||
74 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
75 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
76 | 43020 | jjdelcerro | return intersects(envelope, projection, featureType, geomName,builder);
|
77 | } catch (DataException ex) {
|
||
78 | throw new RuntimeException("Can't create intersects evaluator.",ex); |
||
79 | } |
||
80 | } |
||
81 | |||
82 | 43034 | jjdelcerro | public Evaluator contains(
|
83 | Envelope envelope, |
||
84 | IProjection projection, |
||
85 | FeatureType featureType, |
||
86 | String geomName,
|
||
87 | ExpressionBuilder builder |
||
88 | ){ |
||
89 | 43040 | jjdelcerro | return new ContainsEnvelopeEvaluator(envelope, projection, featureType, geomName, builder); |
90 | 43020 | jjdelcerro | } |
91 | |||
92 | 43034 | jjdelcerro | public Evaluator contains(
|
93 | Geometry geometry, |
||
94 | IProjection projection, |
||
95 | FeatureType featureType, |
||
96 | String geomName,
|
||
97 | ExpressionBuilder builder |
||
98 | ){ |
||
99 | return new ContainsGeometryEvaluator(geometry, projection, featureType, geomName, builder); |
||
100 | 43020 | jjdelcerro | } |
101 | |||
102 | 43034 | jjdelcerro | public Evaluator contains(
|
103 | Geometry geometry, |
||
104 | IProjection projection, |
||
105 | FeatureStore store |
||
106 | ) { |
||
107 | 43020 | jjdelcerro | try {
|
108 | FeatureType featureType = store.getDefaultFeatureType(); |
||
109 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
110 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
111 | 43034 | jjdelcerro | return this.contains(geometry, projection, featureType, geomName,builder); |
112 | 43020 | jjdelcerro | } catch (DataException ex) {
|
113 | throw new RuntimeException("Can't create contains evaluator.",ex); |
||
114 | } |
||
115 | } |
||
116 | |||
117 | 43034 | jjdelcerro | public Evaluator contains(
|
118 | Envelope envelope, |
||
119 | IProjection projection, |
||
120 | FeatureStore store |
||
121 | ) { |
||
122 | 43020 | jjdelcerro | try {
|
123 | FeatureType featureType = store.getDefaultFeatureType(); |
||
124 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
125 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
126 | 43034 | jjdelcerro | return this.contains(envelope, projection, featureType, geomName,builder); |
127 | 43020 | jjdelcerro | } catch (DataException ex) {
|
128 | throw new RuntimeException("Can't create contains evaluator.",ex); |
||
129 | } |
||
130 | } |
||
131 | |||
132 | 43034 | jjdelcerro | public Evaluator not_contains(
|
133 | Geometry geometry, |
||
134 | IProjection projection, |
||
135 | FeatureType featureType, |
||
136 | String geomName,
|
||
137 | ExpressionBuilder builder |
||
138 | ){ |
||
139 | return new OutGeometryEvaluator(geometry, projection, featureType, geomName, builder); |
||
140 | 43020 | jjdelcerro | } |
141 | |||
142 | 43034 | jjdelcerro | public Evaluator not_contains(
|
143 | Geometry geometry, |
||
144 | IProjection projection, |
||
145 | FeatureStore store |
||
146 | ) { |
||
147 | 43020 | jjdelcerro | try {
|
148 | FeatureType featureType = store.getDefaultFeatureType(); |
||
149 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
150 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
151 | 43034 | jjdelcerro | return this.not_contains(geometry, projection, featureType, geomName,builder); |
152 | 43020 | jjdelcerro | } catch (DataException ex) {
|
153 | throw new RuntimeException("Can't create not_contains evaluator.",ex); |
||
154 | } |
||
155 | } |
||
156 | |||
157 | 43034 | jjdelcerro | public Evaluator crosses(
|
158 | Geometry geometry, |
||
159 | IProjection projection, |
||
160 | FeatureType featureType, |
||
161 | String geomName,
|
||
162 | ExpressionBuilder builder |
||
163 | ) { |
||
164 | return new CrossesGeometryEvaluator(geometry, projection, featureType, geomName, builder); |
||
165 | 43020 | jjdelcerro | } |
166 | |||
167 | 43034 | jjdelcerro | public Evaluator crosses(
|
168 | Envelope envelope, |
||
169 | IProjection projection, |
||
170 | FeatureType featureType, |
||
171 | String geomName,
|
||
172 | ExpressionBuilder builder |
||
173 | ) { |
||
174 | return new CrossEnvelopeEvaluator(envelope, projection, featureType, geomName, builder); |
||
175 | 43020 | jjdelcerro | } |
176 | |||
177 | 43034 | jjdelcerro | public Evaluator crosses(
|
178 | Geometry geometry, |
||
179 | IProjection projection, |
||
180 | FeatureStore store |
||
181 | ) { |
||
182 | 43020 | jjdelcerro | try {
|
183 | FeatureType featureType = store.getDefaultFeatureType(); |
||
184 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
185 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
186 | 43034 | jjdelcerro | return this.crosses(geometry, projection, featureType, geomName,builder); |
187 | 43020 | jjdelcerro | } catch (DataException ex) {
|
188 | throw new RuntimeException("Can't create crosses evaluator.",ex); |
||
189 | } |
||
190 | } |
||
191 | |||
192 | 43034 | jjdelcerro | public Evaluator crosses(
|
193 | Envelope envelope, |
||
194 | IProjection projection, |
||
195 | FeatureStore store |
||
196 | ) { |
||
197 | 43020 | jjdelcerro | try {
|
198 | FeatureType featureType = store.getDefaultFeatureType(); |
||
199 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
200 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
201 | 43034 | jjdelcerro | return this.crosses(envelope, projection, featureType, geomName,builder); |
202 | 43020 | jjdelcerro | } catch (DataException ex) {
|
203 | throw new RuntimeException("Can't create crosses evaluator.",ex); |
||
204 | } |
||
205 | } |
||
206 | |||
207 | 43034 | jjdelcerro | public Evaluator disjoint(
|
208 | Geometry geometry, |
||
209 | IProjection projection, |
||
210 | FeatureType featureType, |
||
211 | String geomName,
|
||
212 | ExpressionBuilder builder |
||
213 | ) { |
||
214 | return new DisjointGeometryEvaluator(geometry, projection, featureType, geomName, builder); |
||
215 | 43020 | jjdelcerro | } |
216 | |||
217 | 43034 | jjdelcerro | public Evaluator disjoint(
|
218 | Geometry geometry, |
||
219 | IProjection projection, |
||
220 | FeatureStore store |
||
221 | ) { |
||
222 | 43020 | jjdelcerro | try {
|
223 | FeatureType featureType = store.getDefaultFeatureType(); |
||
224 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
225 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
226 | 43034 | jjdelcerro | return this.disjoint(geometry, projection, featureType, geomName,builder); |
227 | 43020 | jjdelcerro | } catch (DataException ex) {
|
228 | throw new RuntimeException("Can't create disjoint evaluator.",ex); |
||
229 | } |
||
230 | } |
||
231 | |||
232 | 43034 | jjdelcerro | public Evaluator overlaps(
|
233 | Geometry geometry, |
||
234 | IProjection projection, |
||
235 | FeatureType featureType, |
||
236 | String geomName,
|
||
237 | ExpressionBuilder builder |
||
238 | ) { |
||
239 | return new OverlapsGeometryEvaluator(geometry, projection, featureType, geomName, builder); |
||
240 | 43020 | jjdelcerro | } |
241 | |||
242 | 43034 | jjdelcerro | public Evaluator overlaps(
|
243 | Geometry geometry, |
||
244 | IProjection projection, |
||
245 | FeatureStore store |
||
246 | ) { |
||
247 | 43020 | jjdelcerro | try {
|
248 | FeatureType featureType = store.getDefaultFeatureType(); |
||
249 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
250 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
251 | 43034 | jjdelcerro | return this.overlaps(geometry, projection, featureType, geomName,builder); |
252 | 43020 | jjdelcerro | } catch (DataException ex) {
|
253 | throw new RuntimeException("Can't create overlaps evaluator.",ex); |
||
254 | } |
||
255 | } |
||
256 | |||
257 | 43034 | jjdelcerro | public Evaluator touches(
|
258 | Geometry geometry, |
||
259 | IProjection projection, |
||
260 | FeatureType featureType, |
||
261 | String geomName,
|
||
262 | ExpressionBuilder builder |
||
263 | ) { |
||
264 | return new TouchesGeometryEvaluator(geometry, projection, featureType, geomName,builder); |
||
265 | 43020 | jjdelcerro | } |
266 | |||
267 | 43034 | jjdelcerro | public Evaluator touches(
|
268 | Geometry geometry, |
||
269 | IProjection projection, |
||
270 | FeatureStore store |
||
271 | ) { |
||
272 | 43020 | jjdelcerro | try {
|
273 | FeatureType featureType = store.getDefaultFeatureType(); |
||
274 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
275 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
276 | 43034 | jjdelcerro | return this.touches(geometry, projection, featureType, geomName,builder); |
277 | 43020 | jjdelcerro | } catch (DataException ex) {
|
278 | throw new RuntimeException("Can't create touches evaluator.",ex); |
||
279 | } |
||
280 | } |
||
281 | |||
282 | 43034 | jjdelcerro | public Evaluator within(
|
283 | Geometry geometry, |
||
284 | IProjection projection, |
||
285 | FeatureType featureType, |
||
286 | String geomName,
|
||
287 | ExpressionBuilder builder |
||
288 | ) { |
||
289 | return new WithinGeometryEvaluator(geometry, projection, featureType, geomName,builder); |
||
290 | 43020 | jjdelcerro | } |
291 | |||
292 | 43034 | jjdelcerro | public Evaluator within(
|
293 | Geometry geometry, |
||
294 | IProjection projection, |
||
295 | FeatureStore store |
||
296 | ) { |
||
297 | 43020 | jjdelcerro | try {
|
298 | FeatureType featureType = store.getDefaultFeatureType(); |
||
299 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
300 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
301 | 43034 | jjdelcerro | return this.within(geometry, projection, featureType, geomName,builder); |
302 | 43020 | jjdelcerro | } catch (DataException ex) {
|
303 | throw new RuntimeException("Can't create within evaluator.",ex); |
||
304 | } |
||
305 | } |
||
306 | |||
307 | 43034 | jjdelcerro | public Evaluator equals(
|
308 | Geometry geometry, |
||
309 | IProjection projection, |
||
310 | FeatureType featureType, |
||
311 | String geomName,
|
||
312 | ExpressionBuilder builder |
||
313 | ) { |
||
314 | return new EqualsGeometryEvaluator(geometry, projection, featureType, geomName,builder); |
||
315 | 43020 | jjdelcerro | } |
316 | |||
317 | 43034 | jjdelcerro | public Evaluator equals(
|
318 | Geometry geometry, |
||
319 | IProjection projection, |
||
320 | FeatureStore store |
||
321 | ) { |
||
322 | 43020 | jjdelcerro | try {
|
323 | FeatureType featureType = store.getDefaultFeatureType(); |
||
324 | String geomName = featureType.getDefaultGeometryAttributeName();
|
||
325 | 43088 | jjdelcerro | ExpressionBuilder builder = store.createExpression(); |
326 | 43034 | jjdelcerro | return this.equals(geometry, projection, featureType, geomName,builder); |
327 | 43020 | jjdelcerro | } catch (DataException ex) {
|
328 | throw new RuntimeException("Can't create equals evaluator.",ex); |
||
329 | } |
||
330 | } |
||
331 | |||
332 | } |