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