svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.geometry / org.gvsig.expressionevaluator.geometry.lib / org.gvsig.expressionevaluator.geometry.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / DefaultGeometryExpressionBuilderHelper.java @ 44769
History | View | Annotate | Download (26.6 KB)
1 |
package org.gvsig.expressionevaluator.impl; |
---|---|
2 |
|
3 |
import java.text.MessageFormat; |
4 |
import java.util.Objects; |
5 |
import org.cresques.cts.IProjection; |
6 |
import org.gvsig.expressionevaluator.ExpressionBuilder; |
7 |
import org.gvsig.fmap.geom.Geometry; |
8 |
import org.gvsig.fmap.geom.primitive.Envelope; |
9 |
|
10 |
import org.gvsig.expressionevaluator.ExpressionBuilder.AbstractValue; |
11 |
import org.gvsig.expressionevaluator.ExpressionBuilder.Constant; |
12 |
import org.gvsig.expressionevaluator.ExpressionBuilder.Function; |
13 |
import static org.gvsig.expressionevaluator.ExpressionBuilder.PARAMETER_TYPE_CONSTANT; |
14 |
import static org.gvsig.expressionevaluator.ExpressionBuilder.PARAMETER_TYPE_VARIABLE; |
15 |
import org.gvsig.expressionevaluator.ExpressionBuilder.Value; |
16 |
import org.gvsig.expressionevaluator.ExpressionBuilder.Visitor; |
17 |
import org.gvsig.expressionevaluator.ExpressionBuilder.VisitorFilter; |
18 |
import org.gvsig.expressionevaluator.Formatter; |
19 |
import org.gvsig.fmap.geom.GeometryUtils; |
20 |
import org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper; |
21 |
import static org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper.PARAMETER_TYPE_GEOMETRY; |
22 |
|
23 |
public class DefaultGeometryExpressionBuilderHelper |
24 |
implements GeometryExpressionBuilderHelper {
|
25 |
|
26 |
private static final String FORMAT_ST_SRID = "ST_SRID({0})"; |
27 |
private static final String FORMAT_ST_ASTEXT = "ST_AsText({0})"; |
28 |
private static final String FORMAT_ST_ASBINARY = "ST_AsBinary({0})"; |
29 |
private static final String FORMAT_ST_ASEWKB = "ST_AsEWKB({0})"; |
30 |
private static final String FORMAT_ST_CONTAINS = "ST_Contains(({0}), ({1}))"; |
31 |
private static final String FORMAT_ST_CROSSES = "ST_Crosses(({0}), ({1}))"; |
32 |
private static final String FORMAT_ST_DISJOINT = "ST_Disjoint(({0}), ({1}))"; |
33 |
private static final String FORMAT_ST_EQUALS = "ST_Equals(({0}), ({1}))"; |
34 |
private static final String FORMAT_ST_ISCLOSED = "ST_IsClosed({0})"; |
35 |
private static final String FORMAT_ST_OVERLAPS = "ST_Overlaps(({0}), ({1}))"; |
36 |
private static final String FORMAT_ST_TOUCHES = "ST_Touches(({0}), ({1}))"; |
37 |
private static final String FORMAT_ST_WITHIN = "ST_Within(({0}), ({1}))"; |
38 |
private static final String FORMAT_ST_ENVELOPE = "ST_Envelope({0})"; |
39 |
private static final String FORMAT_ST_FORCE2D = "ST_Force2D({0})"; |
40 |
private static final String FORMAT_ST_INTERSECTS = "ST_Intersects(({0}), ({1}))"; |
41 |
private static final String FORMAT_ST_GEOMFROMTEXT = "ST_GeomFromText(({0}), ({1}))"; |
42 |
private static final String FORMAT_ST_GEOMFROMWKB = "ST_GeomFromWKB(({0}), ({1}))"; |
43 |
private static final String FORMAT_ST_GEOMFROMEWKB = "ST_GeomFromEWKB(({0}), ({1}))"; |
44 |
private static final String FORMAT_ST_SIMPLIFY = "ST_Simplify(({0}), ({1}))"; |
45 |
|
46 |
public class GeometryParameterBase |
47 |
extends AbstractValue
|
48 |
implements GeometryParameter {
|
49 |
|
50 |
protected Value srs;
|
51 |
protected GeometryExpressionBuilderHelper builder;
|
52 |
protected String name; |
53 |
protected Object value; |
54 |
protected int type; |
55 |
/*
|
56 |
Para un parametro de tipo Geometria, el srs sera siempre un Constant
|
57 |
excepto cuando se le asigne una geometria contante al parametro y esta
|
58 |
tenga un SRS asignado. En este caso, tanto la geometria como el SRS
|
59 |
se trataran como parametros.
|
60 |
|
61 |
Si se quiere que el SRS sea un Parameter, se construira como tal.
|
62 |
*/
|
63 |
public GeometryParameterBase(GeometryExpressionBuilderHelper builder) {
|
64 |
this.type = PARAMETER_TYPE_CONSTANT;
|
65 |
this.name = null; |
66 |
this.value = null; |
67 |
this.builder = builder;
|
68 |
} |
69 |
|
70 |
@Override
|
71 |
public void accept(Visitor visitor, VisitorFilter filter) { |
72 |
super.accept(visitor, filter);
|
73 |
if (this.srs != null) { |
74 |
this.srs.accept(visitor, filter);
|
75 |
} |
76 |
} |
77 |
|
78 |
@Override
|
79 |
public void replace(Value target, Value replacement) { |
80 |
if( this.srs == target ) { |
81 |
this.srs = replacement;
|
82 |
} else {
|
83 |
this.srs.replace(target, replacement);
|
84 |
} |
85 |
} |
86 |
|
87 |
@Override
|
88 |
public GeometryParameter value(Object value) { |
89 |
if( value instanceof Geometry ) { |
90 |
if( this.srs == null ) { |
91 |
IProjection proj = ((Geometry)value).getProjection(); |
92 |
this.srs(this.builder.parameter().value(proj)); |
93 |
} |
94 |
} |
95 |
this.value = value;
|
96 |
return this; |
97 |
} |
98 |
|
99 |
@Override
|
100 |
public GeometryParameter srs(IProjection srs) {
|
101 |
this.srs = new ProjectionConstant(this.builder, srs); |
102 |
if( this.type == PARAMETER_TYPE_VARIABLE ) { |
103 |
this.type = PARAMETER_TYPE_GEOMETRY;
|
104 |
} |
105 |
return this; |
106 |
} |
107 |
|
108 |
@Override
|
109 |
public GeometryParameter srs(Value srs) {
|
110 |
this.srs = srs;
|
111 |
if( this.type == PARAMETER_TYPE_VARIABLE ) { |
112 |
this.type = PARAMETER_TYPE_GEOMETRY;
|
113 |
} |
114 |
return this; |
115 |
} |
116 |
|
117 |
@Override
|
118 |
public Value srs() {
|
119 |
return this.srs; |
120 |
} |
121 |
|
122 |
@Override
|
123 |
public Geometry geometry() {
|
124 |
return (Geometry) this.value; |
125 |
} |
126 |
|
127 |
|
128 |
@Override
|
129 |
public GeometryParameter as_constant() {
|
130 |
this.type = PARAMETER_TYPE_CONSTANT;
|
131 |
if (this.value == null && this.name != null) { |
132 |
this.value = this.name; |
133 |
} |
134 |
return this; |
135 |
} |
136 |
|
137 |
@Override
|
138 |
public GeometryParameter as_variable() {
|
139 |
this.type = PARAMETER_TYPE_VARIABLE;
|
140 |
if (this.value != null && this.name == null) { |
141 |
this.name = (String) this.value; |
142 |
} |
143 |
return this; |
144 |
} |
145 |
|
146 |
@Override
|
147 |
public GeometryParameter name(String name) { |
148 |
this.type = PARAMETER_TYPE_VARIABLE;
|
149 |
this.name = name;
|
150 |
return this; |
151 |
} |
152 |
|
153 |
@Override
|
154 |
public String name() { |
155 |
switch (this.type) { |
156 |
case PARAMETER_TYPE_VARIABLE:
|
157 |
return this.name; |
158 |
case PARAMETER_TYPE_CONSTANT:
|
159 |
if (this.value == null) { |
160 |
return null; |
161 |
} |
162 |
return this.value.toString(); |
163 |
default:
|
164 |
if (this.name != null) { |
165 |
return this.name; |
166 |
} |
167 |
if (this.value != null) { |
168 |
return this.value.toString(); |
169 |
} |
170 |
return null; |
171 |
} |
172 |
} |
173 |
|
174 |
@Override
|
175 |
public int type() { |
176 |
return this.type; |
177 |
} |
178 |
|
179 |
@Override
|
180 |
public boolean is_constant() { |
181 |
return this.type == PARAMETER_TYPE_CONSTANT; |
182 |
} |
183 |
|
184 |
@Override
|
185 |
public boolean is_variable() { |
186 |
return this.type == PARAMETER_TYPE_VARIABLE; |
187 |
} |
188 |
|
189 |
@Override
|
190 |
public GeometryParameter as_geometry_variable() {
|
191 |
this.type = PARAMETER_TYPE_GEOMETRY;
|
192 |
if (this.value == null && this.name != null) { |
193 |
this.value = this.name; |
194 |
} |
195 |
return this; |
196 |
} |
197 |
|
198 |
@Override
|
199 |
public boolean is_geometry_variable() { |
200 |
return this.type == PARAMETER_TYPE_GEOMETRY; |
201 |
} |
202 |
|
203 |
@Override
|
204 |
public Object value() { |
205 |
try {
|
206 |
switch (this.type) { |
207 |
case PARAMETER_TYPE_CONSTANT:
|
208 |
if( this.value instanceof Geometry ) { |
209 |
switch (this.builder.geometry_support_type()) { |
210 |
case EWKB:
|
211 |
return GeometryUtils.toEWKB(this.geometry()); |
212 |
case WKB:
|
213 |
return GeometryUtils.toWKB(this.geometry()); |
214 |
case WKT:
|
215 |
default:
|
216 |
return GeometryUtils.toWKT(this.geometry()); |
217 |
} |
218 |
} |
219 |
if( this.value instanceof IProjection ) { |
220 |
return this.builder.srs_id((IProjection) this.value); |
221 |
} |
222 |
return this.value; |
223 |
case PARAMETER_TYPE_VARIABLE:
|
224 |
case PARAMETER_TYPE_GEOMETRY:
|
225 |
default:
|
226 |
return this.value; |
227 |
} |
228 |
} catch (Exception ex) { |
229 |
throw new RuntimeException("Can't get value from parameter.", ex); |
230 |
} |
231 |
} |
232 |
|
233 |
@Override
|
234 |
public String toString() { |
235 |
return this.toString(this.builder.builder().formatter()); |
236 |
} |
237 |
|
238 |
@Override
|
239 |
public String toString(Formatter<Value> formatter) { |
240 |
if( formatter!=null && formatter.canApply(this) ) { |
241 |
return formatter.format(this); |
242 |
} |
243 |
switch (this.type) { |
244 |
case PARAMETER_TYPE_CONSTANT:
|
245 |
if( this.value instanceof Geometry ) { |
246 |
switch (this.builder.geometry_support_type()) { |
247 |
case EWKB:
|
248 |
return MessageFormat.format( |
249 |
FORMAT_ST_GEOMFROMEWKB, |
250 |
"?",
|
251 |
this.getSRS(formatter)
|
252 |
); |
253 |
case WKB:
|
254 |
return MessageFormat.format( |
255 |
FORMAT_ST_GEOMFROMWKB, |
256 |
"?",
|
257 |
this.getSRS(formatter)
|
258 |
); |
259 |
case WKT:
|
260 |
default:
|
261 |
return MessageFormat.format( |
262 |
FORMAT_ST_GEOMFROMTEXT, |
263 |
"?",
|
264 |
this.getSRS(formatter)
|
265 |
); |
266 |
} |
267 |
} |
268 |
case PARAMETER_TYPE_VARIABLE:
|
269 |
default:
|
270 |
return "?"; |
271 |
case PARAMETER_TYPE_GEOMETRY:
|
272 |
switch (this.builder.geometry_support_type()) { |
273 |
case EWKB:
|
274 |
return MessageFormat.format( |
275 |
FORMAT_ST_GEOMFROMEWKB, |
276 |
"?",
|
277 |
getSRS(formatter) |
278 |
); |
279 |
case WKB:
|
280 |
return MessageFormat.format( |
281 |
FORMAT_ST_GEOMFROMWKB, |
282 |
"?",
|
283 |
getSRS(formatter) |
284 |
); |
285 |
case WKT:
|
286 |
default:
|
287 |
return MessageFormat.format( |
288 |
FORMAT_ST_GEOMFROMTEXT, |
289 |
"?",
|
290 |
getSRS(formatter) |
291 |
); |
292 |
} |
293 |
} |
294 |
} |
295 |
|
296 |
private String getSRS(Formatter formatter) { |
297 |
if( this.srs!=null ) { |
298 |
return this.srs.toString(formatter); |
299 |
} |
300 |
if( this.value instanceof Geometry ) { |
301 |
IProjection proj = ((Geometry)this.value).getProjection();
|
302 |
Object s = this.builder.srs_id(proj); |
303 |
if( s == null ) { |
304 |
throw new IllegalArgumentException("A parameter of type Geometry with an invalid SRS."); |
305 |
} |
306 |
return s.toString();
|
307 |
} |
308 |
throw new IllegalArgumentException("The parameter of type Geometry need a SRS."); |
309 |
} |
310 |
|
311 |
} |
312 |
|
313 |
//
|
314 |
// public static class ProjectionParameterBase
|
315 |
// extends ParameterBase
|
316 |
// implements Parameter {
|
317 |
//
|
318 |
// protected GeometryExpressionBuilderHelper builder;
|
319 |
//
|
320 |
// public ProjectionParameterBase(GeometryExpressionBuilderHelper builder) {
|
321 |
// this.builder = builder;
|
322 |
// }
|
323 |
//
|
324 |
// @Override
|
325 |
// public Parameter value(Object value) {
|
326 |
// if( !(value instanceof IProjection) ) {
|
327 |
// throw new IllegalArgumentException("Only IProjection are allowed.");
|
328 |
// }
|
329 |
// return super.value(value);
|
330 |
// }
|
331 |
//
|
332 |
// @Override
|
333 |
// public Object value() {
|
334 |
// try {
|
335 |
// switch (this.type) {
|
336 |
// case PARAMETER_TYPE_CONSTANT:
|
337 |
// return this.builder.srs_id((IProjection) this.value);
|
338 |
// case PARAMETER_TYPE_VARIABLE:
|
339 |
// default:
|
340 |
// return this.value;
|
341 |
// }
|
342 |
// } catch (Exception ex) {
|
343 |
// throw new RuntimeException("Can't get value from parameter.", ex);
|
344 |
// }
|
345 |
// }
|
346 |
// }
|
347 |
|
348 |
public static class GeometryConstant extends AbstractValue implements Constant { |
349 |
|
350 |
protected Geometry geometry;
|
351 |
protected GeometryExpressionBuilderHelper builder;
|
352 |
|
353 |
public GeometryConstant(GeometryExpressionBuilderHelper builder, Geometry geometry) {
|
354 |
this.builder = builder;
|
355 |
this.geometry = geometry;
|
356 |
} |
357 |
|
358 |
@Override
|
359 |
public String toString() { |
360 |
return this.toString(builder.builder().formatter()); |
361 |
} |
362 |
|
363 |
@Override
|
364 |
public String toString(Formatter<Value> formatter) { |
365 |
if( formatter!=null && formatter.canApply(this) ) { |
366 |
return formatter.format(this); |
367 |
} |
368 |
try {
|
369 |
switch (this.builder.geometry_support_type()) { |
370 |
case EWKB:
|
371 |
return MessageFormat.format( |
372 |
FORMAT_ST_GEOMFROMEWKB, |
373 |
"DECODE('"+this.builder.builder().bytearray_hex(GeometryUtils.toEWKB(geometry))+"','hex')", |
374 |
this.getSRS()
|
375 |
); |
376 |
case WKB:
|
377 |
return MessageFormat.format( |
378 |
FORMAT_ST_GEOMFROMWKB, |
379 |
"DECODE('"+this.builder.builder().bytearray_hex(GeometryUtils.toWKB(geometry))+"','hex')", |
380 |
this.getSRS()
|
381 |
); |
382 |
case WKT:
|
383 |
default:
|
384 |
return MessageFormat.format( |
385 |
FORMAT_ST_GEOMFROMTEXT, |
386 |
this.builder.builder().string(GeometryUtils.toWKT(geometry)),
|
387 |
this.getSRS()
|
388 |
); |
389 |
} |
390 |
} catch(Throwable th) { |
391 |
throw th;
|
392 |
} |
393 |
} |
394 |
|
395 |
@Override
|
396 |
public Object value() { |
397 |
return this.geometry; |
398 |
} |
399 |
|
400 |
private String getSRS() { |
401 |
IProjection proj = this.geometry.getProjection();
|
402 |
Object s = this.builder.srs_id(proj); |
403 |
if( s == null ) { |
404 |
throw new IllegalArgumentException("A parameter of type Geometry with an invalid SRS."); |
405 |
} |
406 |
return s.toString();
|
407 |
} |
408 |
|
409 |
} |
410 |
|
411 |
public static class ProjectionConstant extends AbstractValue implements Constant { |
412 |
|
413 |
protected IProjection projection;
|
414 |
protected GeometryExpressionBuilderHelper builder;
|
415 |
|
416 |
public ProjectionConstant(GeometryExpressionBuilderHelper builder, IProjection projection) {
|
417 |
this.projection = projection;
|
418 |
this.builder = builder;
|
419 |
} |
420 |
|
421 |
@Override
|
422 |
public String toString() { |
423 |
return this.toString(this.builder.builder().formatter()); |
424 |
} |
425 |
|
426 |
@Override
|
427 |
public String toString(Formatter<Value> formatter) { |
428 |
if( formatter!=null && formatter.canApply(this) ) { |
429 |
return formatter.format(this); |
430 |
} |
431 |
return Objects.toString(this.builder.srs_id(this.projection)); |
432 |
} |
433 |
|
434 |
@Override
|
435 |
public Object value() { |
436 |
return this.projection; |
437 |
} |
438 |
|
439 |
} |
440 |
|
441 |
protected GeometrySupportType geometrySupportType;
|
442 |
protected ExpressionBuilder builder;
|
443 |
|
444 |
public DefaultGeometryExpressionBuilderHelper(ExpressionBuilder builder) {
|
445 |
this.builder = builder;
|
446 |
this.geometrySupportType = GeometrySupportType.WKB;
|
447 |
} |
448 |
|
449 |
public DefaultGeometryExpressionBuilderHelper() {
|
450 |
this.geometrySupportType = GeometrySupportType.WKB;
|
451 |
} |
452 |
|
453 |
@Override
|
454 |
public ExpressionBuilder builder() {
|
455 |
return this.builder; |
456 |
} |
457 |
|
458 |
@Override
|
459 |
public GeometrySupportType geometry_support_type() {
|
460 |
return this.geometrySupportType; |
461 |
} |
462 |
|
463 |
@Override
|
464 |
public GeometryExpressionBuilderHelper geometry_support_type(GeometrySupportType geometrySupportType) {
|
465 |
this.geometrySupportType = geometrySupportType;
|
466 |
return this; |
467 |
} |
468 |
|
469 |
@Override
|
470 |
public Object srs_id(IProjection projection) { |
471 |
if( projection==null ) { |
472 |
return 0; |
473 |
} |
474 |
return ProjectionUtils.getCode(projection);
|
475 |
} |
476 |
|
477 |
@Override
|
478 |
public Constant srs(IProjection projection) {
|
479 |
return new ProjectionConstant(this, projection); |
480 |
} |
481 |
|
482 |
@Override
|
483 |
public Constant geometry(Geometry geom, IProjection projection) {
|
484 |
geom.setProjection(projection); |
485 |
return new GeometryConstant(this, geom); |
486 |
} |
487 |
|
488 |
@Override
|
489 |
public Constant geometry(Geometry geom) {
|
490 |
if( geom.getProjection()==null ) { |
491 |
throw new IllegalArgumentException("The geometry does not have an associated projection. Use 'geometry(Geometry, IProjection)'."); |
492 |
} |
493 |
return new GeometryConstant(this, geom); |
494 |
} |
495 |
|
496 |
@Override
|
497 |
public Constant envelope(Envelope envelope, IProjection projection) {
|
498 |
Geometry geom = envelope.getGeometry(); |
499 |
geom.setProjection(projection); |
500 |
return new GeometryConstant(this, geom); |
501 |
} |
502 |
|
503 |
@Override
|
504 |
public Constant envelope(Envelope envelope) {
|
505 |
if( envelope.getProjection()==null ) { |
506 |
throw new IllegalArgumentException("The envelope does not have an associated projection. Use 'envelope(Geometry, IProjection)'."); |
507 |
} |
508 |
Geometry geom = envelope.getGeometry(); |
509 |
return new GeometryConstant(this, geom); |
510 |
} |
511 |
|
512 |
@Override
|
513 |
public GeometryParameter parameter() {
|
514 |
GeometryParameterBase p = new GeometryParameterBase(this); |
515 |
return p;
|
516 |
} |
517 |
|
518 |
@Override
|
519 |
public GeometryParameter parameter(String name) { |
520 |
GeometryParameterBase p = new GeometryParameterBase(this); |
521 |
p.name(name); |
522 |
return p;
|
523 |
} |
524 |
|
525 |
@Override
|
526 |
public GeometryParameter parameter(Object value) { |
527 |
GeometryParameterBase p = new GeometryParameterBase(this); |
528 |
p.value(value); |
529 |
return p;
|
530 |
} |
531 |
|
532 |
public Function builtin_function(String name, String format, Value... values) { |
533 |
Function func = this.builder.function(name, values);
|
534 |
func.format(format); |
535 |
return func;
|
536 |
} |
537 |
|
538 |
public Function function(String name, Value... values) { |
539 |
Function func = this.builder.function(name, values);
|
540 |
return func;
|
541 |
} |
542 |
|
543 |
@Override
|
544 |
public Function as_geometry(Value value) {
|
545 |
return builtin_function(FUNCTION_ST_ASBINARY, FORMAT_ST_ASBINARY, value);
|
546 |
} |
547 |
|
548 |
@Override
|
549 |
public Function ST_Intersects(Value geom1, Value geom2) {
|
550 |
return builtin_function(FUNCTION_ST_INTERSECTS, FORMAT_ST_INTERSECTS, geom1, geom2);
|
551 |
} |
552 |
|
553 |
@Override
|
554 |
public Function ST_SRID(Value geom) {
|
555 |
return builtin_function(FUNCTION_ST_SRID, FORMAT_ST_SRID, geom);
|
556 |
} |
557 |
|
558 |
@Override
|
559 |
public Function ST_Envelope(Value geom) {
|
560 |
return builtin_function(FUNCTION_ST_ENVELOPE, FORMAT_ST_ENVELOPE, geom);
|
561 |
} |
562 |
|
563 |
@Override
|
564 |
public Function ST_Force2D(Value geom) {
|
565 |
return builtin_function(FUNCTION_ST_FORCE2D, FORMAT_ST_FORCE2D, geom);
|
566 |
} |
567 |
|
568 |
@Override
|
569 |
public Function ST_AsText(Value geom) {
|
570 |
return builtin_function(FUNCTION_ST_ASTEXT, FORMAT_ST_ASTEXT, geom);
|
571 |
} |
572 |
|
573 |
@Override
|
574 |
public Function ST_AsBinary(Value geom) {
|
575 |
return builtin_function(FUNCTION_ST_ASBINARY, FORMAT_ST_ASBINARY, geom);
|
576 |
} |
577 |
|
578 |
@Override
|
579 |
public Function ST_AsEWKB(Value geom) {
|
580 |
return builtin_function(FUNCTION_ST_ASEWKB, FORMAT_ST_ASEWKB, geom);
|
581 |
} |
582 |
|
583 |
@Override
|
584 |
public Function ST_GeomFromText(Value geom, Value crs) {
|
585 |
return builtin_function(FUNCTION_ST_GEOMFROMTEXT, FORMAT_ST_GEOMFROMTEXT, geom, crs);
|
586 |
} |
587 |
|
588 |
@Override
|
589 |
public Function ST_GeomFromWKB(Value geom, Value crs) {
|
590 |
return builtin_function(FUNCTION_ST_GEOMFROMWKB, FORMAT_ST_GEOMFROMWKB, geom, crs);
|
591 |
} |
592 |
|
593 |
@Override
|
594 |
public Function ST_GeomFromEWKB(Value geom, Value crs) {
|
595 |
return builtin_function(FUNCTION_ST_GEOMFROMEWKB, FORMAT_ST_GEOMFROMEWKB, geom, crs);
|
596 |
} |
597 |
|
598 |
@Override
|
599 |
public Function ST_Simplify(Value geom, Value tolerance) {
|
600 |
return builtin_function(FUNCTION_ST_SIMPLIFY, FORMAT_ST_SIMPLIFY, tolerance);
|
601 |
} |
602 |
|
603 |
@Override
|
604 |
public Function ST_Disjoint(Value geom1, Value geom2) {
|
605 |
return builtin_function(FUNCTION_ST_DISJOINT, FORMAT_ST_DISJOINT, geom1, geom2);
|
606 |
} |
607 |
|
608 |
@Override
|
609 |
public Function ST_Contains(Value geom1, Value geom2) {
|
610 |
return builtin_function(FUNCTION_ST_CONTAINS, FORMAT_ST_CONTAINS, geom1, geom2);
|
611 |
} |
612 |
|
613 |
@Override
|
614 |
public Function ST_Equals(Value geom1, Value geom2) {
|
615 |
return builtin_function(FUNCTION_ST_EQUALS, FORMAT_ST_EQUALS, geom1, geom2);
|
616 |
} |
617 |
|
618 |
@Override
|
619 |
public Function ST_Crosses(Value geom1, Value geom2) {
|
620 |
return builtin_function(FUNCTION_ST_CROSSES, FORMAT_ST_CROSSES, geom1, geom2);
|
621 |
} |
622 |
|
623 |
@Override
|
624 |
public Function ST_IsClosed(Value geom) {
|
625 |
return builtin_function(FUNCTION_ST_ISCLOSED, FORMAT_ST_ISCLOSED, geom);
|
626 |
} |
627 |
|
628 |
@Override
|
629 |
public Function ST_Overlaps(Value geom1, Value geom2) {
|
630 |
return builtin_function(FUNCTION_ST_OVERLAPS, FORMAT_ST_OVERLAPS, geom1, geom2);
|
631 |
} |
632 |
|
633 |
@Override
|
634 |
public Function ST_Touches(Value geom1, Value geom2) {
|
635 |
return builtin_function(FUNCTION_ST_TOUCHES, FORMAT_ST_TOUCHES, geom1, geom2);
|
636 |
} |
637 |
|
638 |
@Override
|
639 |
public Function ST_Within(Value geom1, Value geom2) {
|
640 |
return builtin_function("ST_Within", FORMAT_ST_WITHIN, geom1, geom2); |
641 |
} |
642 |
|
643 |
@Override
|
644 |
public Function ST_Area(Value geom) {
|
645 |
return function("ST_Area", geom); |
646 |
} |
647 |
|
648 |
@Override
|
649 |
public Function ST_Buffer(Value geom) {
|
650 |
return function("ST_Buffer", geom); |
651 |
} |
652 |
|
653 |
@Override
|
654 |
public Function ST_Buffer(Value geom, Value dist) {
|
655 |
return function("ST_Buffer", geom, dist); |
656 |
} |
657 |
|
658 |
@Override
|
659 |
public Function ST_Centroid(Value geom) {
|
660 |
return function("ST_Centroid", geom); |
661 |
} |
662 |
|
663 |
@Override
|
664 |
public Function ST_CoveredBy(Value geom1, Value geom2) {
|
665 |
return function("ST_CoveredBy", geom1, geom2); |
666 |
} |
667 |
|
668 |
@Override
|
669 |
public Function ST_Covers(Value geom1, Value geom2) {
|
670 |
return function("ST_Covers", geom1, geom2); |
671 |
} |
672 |
|
673 |
@Override
|
674 |
public Function ST_Diference(Value geom1, Value geom2) {
|
675 |
return function("ST_Diference", geom1, geom2); |
676 |
} |
677 |
|
678 |
@Override
|
679 |
public Function ST_Dimension(Value geom) {
|
680 |
return function("ST_Dimension", geom); |
681 |
} |
682 |
|
683 |
@Override
|
684 |
public Function ST_Distance(Value geom1, Value geom2) {
|
685 |
return function("ST_Distance", geom1, geom2); |
686 |
} |
687 |
|
688 |
@Override
|
689 |
public Function ST_EndPoint(Value geom) {
|
690 |
return function("ST_EndPoint", geom); |
691 |
} |
692 |
|
693 |
@Override
|
694 |
public Function ST_Intersection(Value geom1, Value geom2) {
|
695 |
return function("ST_Intersection", geom1, geom2); |
696 |
} |
697 |
|
698 |
@Override
|
699 |
public Function ST_IsSimple(Value geom) {
|
700 |
return function("ST_IsSimple", geom); |
701 |
} |
702 |
|
703 |
@Override
|
704 |
public Function ST_IsValid(Value geom) {
|
705 |
return function("ST_IsValid", geom); |
706 |
} |
707 |
|
708 |
@Override
|
709 |
public Function ST_NumGeometries(Value geom) {
|
710 |
return function("ST_NumGeometries", geom); |
711 |
} |
712 |
|
713 |
@Override
|
714 |
public Function ST_NumPoints(Value geom) {
|
715 |
return function("ST_NumPoints", geom); |
716 |
} |
717 |
|
718 |
@Override
|
719 |
public Function ST_Perimeter(Value geom) {
|
720 |
return function("ST_Perimeter", geom); |
721 |
} |
722 |
|
723 |
@Override
|
724 |
public Function ST_PointN(Value geom, Value n) {
|
725 |
return function("ST_PointN", geom, n); |
726 |
} |
727 |
|
728 |
@Override
|
729 |
public Function ST_StartPoint(Value geom) {
|
730 |
return function("ST_StartPoint", geom); |
731 |
} |
732 |
|
733 |
@Override
|
734 |
public Function ST_Union(Value geom1, Value geom2) {
|
735 |
return function("ST_Union", geom1, geom2); |
736 |
} |
737 |
|
738 |
@Override
|
739 |
public Function ST_X(Value geom) {
|
740 |
return function("ST_X", geom); |
741 |
} |
742 |
|
743 |
@Override
|
744 |
public Function ST_Y(Value geom) {
|
745 |
return function("ST_Y", geom); |
746 |
} |
747 |
|
748 |
@Override
|
749 |
public Function ST_Z(Value geom) {
|
750 |
return function("ST_Z", geom); |
751 |
} |
752 |
|
753 |
@Override
|
754 |
public Function ST_ExtentAggregate(Value geom) {
|
755 |
return function(FUNCTION_ST_EXTENTAGGREGATE, geom);
|
756 |
} |
757 |
|
758 |
@Override
|
759 |
public Function ST_UnionAggregate(Value geom) {
|
760 |
return function(FUNCTION_ST_UNIONAGGREGATE, geom);
|
761 |
} |
762 |
|
763 |
@Override
|
764 |
public Function ST_Point(Value x, Value y) {
|
765 |
return function(FUNCTION_ST_POINT, x, y);
|
766 |
} |
767 |
|
768 |
@Override
|
769 |
public Function ST_MakePoint(Value x, Value y) {
|
770 |
return function(FUNCTION_ST_MAKEPOINT, x, y);
|
771 |
} |
772 |
|
773 |
@Override
|
774 |
public Function ST_MakePoint(Value x, Value y, Value z) {
|
775 |
return function(FUNCTION_ST_MAKEPOINT, x, y, z);
|
776 |
} |
777 |
|
778 |
@Override
|
779 |
public Function ST_MakePoint(Value x, Value y, Value z, Value m) {
|
780 |
return function(FUNCTION_ST_MAKEPOINT, x, y, z, m);
|
781 |
} |
782 |
|
783 |
@Override
|
784 |
public Function ST_SetSRID(Value geom, Value srid) {
|
785 |
return function(FUNCTION_ST_POINT, geom, srid);
|
786 |
} |
787 |
|
788 |
} |