Statistics
| Revision:

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 @ 47576

History | View | Annotate | Download (29.4 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.expressionevaluator.ExpressionBuilder.AbstractValue;
8
import org.gvsig.expressionevaluator.ExpressionBuilder.Constant;
9
import org.gvsig.expressionevaluator.ExpressionBuilder.Function;
10
import static org.gvsig.expressionevaluator.ExpressionBuilder.PARAMETER_TYPE_CONSTANT;
11
import static org.gvsig.expressionevaluator.ExpressionBuilder.PARAMETER_TYPE_VARIABLE;
12
import org.gvsig.expressionevaluator.ExpressionBuilder.Value;
13
import org.gvsig.expressionevaluator.ExpressionBuilder.Visitor;
14
import org.gvsig.expressionevaluator.ExpressionBuilder.VisitorFilter;
15
import org.gvsig.expressionevaluator.Formatter;
16
import org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper;
17
import static org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper.PARAMETER_TYPE_GEOMETRY;
18
import org.gvsig.fmap.geom.Geometry;
19
import org.gvsig.fmap.geom.GeometryUtils;
20
import org.gvsig.fmap.geom.primitive.Envelope;
21

    
22
public class DefaultGeometryExpressionBuilderHelper 
23
        implements GeometryExpressionBuilderHelper {
24
    
25
    private static final String FORMAT_ST_SRID = "ST_SRID({0})";
26
    private static final String FORMAT_ST_ASTEXT = "ST_AsText({0})";
27
    private static final String FORMAT_ST_ASBINARY = "ST_AsBinary({0})";
28
    private static final String FORMAT_ST_ASEWKB = "ST_AsEWKB({0})";
29
    private static final String FORMAT_ST_CONTAINS = "ST_Contains(({0}), ({1}))";
30
    private static final String FORMAT_ST_CROSSES = "ST_Crosses(({0}), ({1}))";
31
    private static final String FORMAT_ST_DISJOINT = "ST_Disjoint(({0}), ({1}))";
32
    private static final String FORMAT_ST_EQUALS = "ST_Equals(({0}), ({1}))";
33
    private static final String FORMAT_ST_ISCLOSED = "ST_IsClosed({0})";
34
    private static final String FORMAT_ST_OVERLAPS = "ST_Overlaps(({0}), ({1}))";
35
    private static final String FORMAT_ST_TOUCHES = "ST_Touches(({0}), ({1}))";
36
    private static final String FORMAT_ST_WITHIN = "ST_Within(({0}), ({1}))";
37
    private static final String FORMAT_ST_ENVELOPE = "ST_Envelope({0})";
38
    private static final String FORMAT_ST_FORCE2D = "ST_Force2D({0})";
39
    private static final String FORMAT_ST_INTERSECTS = "ST_Intersects(({0}), ({1}))";
40
    private static final String FORMAT_ST_GEOMFROMTEXT = "ST_GeomFromText(({0}), ({1}))";
41
    private static final String FORMAT_ST_GEOMFROMWKB = "ST_GeomFromWKB(({0}), ({1}))";
42
    private static final String FORMAT_ST_GEOMFROMEWKB = "ST_GeomFromEWKB(({0}), ({1}))";
43
    private static final String FORMAT_ST_SIMPLIFY = "ST_Simplify(({0}), ({1}))";
44

    
45
    public class GeometryParameterBase 
46
            extends AbstractValue 
47
            implements GeometryParameter {
48

    
49
        protected Value srs;
50
        protected GeometryExpressionBuilderHelper builder;
51
        protected String name;
52
        protected Object value;
53
        protected int type;
54
        /*
55
        Para un parametro de tipo Geometria, el srs sera siempre un Constant
56
        excepto cuando se le asigne una geometria contante al parametro y esta
57
        tenga un SRS asignado. En este caso, tanto la geometria como el SRS
58
        se trataran como parametros.
59
        
60
        Si se quiere que el SRS sea un Parameter, se construira como tal.
61
        */
62
        public GeometryParameterBase(GeometryExpressionBuilderHelper builder) {
63
            this.type = PARAMETER_TYPE_CONSTANT;
64
            this.name = null;
65
            this.value = null;
66
            this.builder = builder;
67
        }
68

    
69
        @Override
70
        public Value clone() throws CloneNotSupportedException {
71
            GeometryParameterBase other = (GeometryParameterBase) super.clone();
72
            other.srs = (Value) org.gvsig.tools.lang.Cloneable.cloneQuietly(srs);
73
            return other;
74
        }
75
        
76
        
77

    
78
        @Override
79
        public void accept(Visitor visitor, VisitorFilter filter) {
80
            boolean visitChildren = true;
81
            if (filter==null || filter.accept(this)) {
82
                visitor.visit(this);
83
            } else {
84
                visitChildren = !filter.skipChildren();
85
            }
86
            if (visitChildren) {
87
                if (this.srs != null) {
88
                    switch (this.type) {
89
                        case PARAMETER_TYPE_CONSTANT:
90
                        case PARAMETER_TYPE_GEOMETRY:
91
                            switch (this.builder.geometry_support_type()) {
92
                                case NATIVE:
93
                                    break;
94
                                case EWKB:
95
                                case WKB:
96
                                case WKT:
97
                                default:
98
                                    this.srs.accept(visitor, filter);
99
                            }
100
                            break;
101
                        case PARAMETER_TYPE_VARIABLE:
102
                        default:
103
                            // No esta claro si aqui debe hacerse un accept o no
104
                            this.srs.accept(visitor, filter);
105
                            break;
106
                    }
107
                }
108
            }
109
        }
110

    
111
        @Override
112
        public void replace(Value target, Value replacement) {
113
            if( this.srs == null){
114
                return;
115
            }
116
            if( this.srs == target ) {
117
                this.srs = replacement;
118
            } else {
119
                this.srs.replace(target, replacement);
120
            }
121
        }
122

    
123
        @Override
124
        public GeometryParameter value(Object value) {
125
            if( value instanceof Geometry ) {
126
                if( this.srs == null ) {
127
                    IProjection proj = ((Geometry)value).getProjection();
128
                    this.srs(this.builder.parameter().value(proj));
129
                }
130
            }
131
            this.value = value;
132
            return this;
133
        }
134

    
135
        @Override
136
        public GeometryParameter srs(IProjection srs) {
137
            this.srs = new ProjectionConstant(this.builder, srs);
138
            if( this.type == PARAMETER_TYPE_VARIABLE ) {
139
                this.type = PARAMETER_TYPE_GEOMETRY;
140
            }
141
            return this;
142
        }
143

    
144
        @Override
145
        public GeometryParameter srs(Value srs) {
146
            this.srs = srs;
147
            if( this.type == PARAMETER_TYPE_VARIABLE ) {
148
                this.type = PARAMETER_TYPE_GEOMETRY;
149
            }
150
            return this;
151
        }
152

    
153
        @Override
154
        public Value srs() {
155
            return this.srs;
156
        }
157

    
158
        @Override
159
        public Geometry geometry() {
160
            return (Geometry) this.value;
161
        }
162

    
163

    
164
        @Override
165
        public GeometryParameter as_constant() {
166
            this.type = PARAMETER_TYPE_CONSTANT;
167
            if (this.value == null && this.name != null) {
168
                this.value = this.name;
169
            }
170
            return this;
171
        }
172

    
173
        @Override
174
        public GeometryParameter as_variable() {
175
            this.type = PARAMETER_TYPE_VARIABLE;
176
            if (this.value != null && this.name == null) {
177
                this.name = (String) this.value;
178
            }
179
            return this;
180
        }
181

    
182
        @Override
183
        public GeometryParameter name(String name) {
184
            this.type = PARAMETER_TYPE_VARIABLE;
185
            this.name = name;
186
            return this;
187
        }
188
        
189
        @Override
190
        public String name() {
191
            switch (this.type) {
192
                case PARAMETER_TYPE_VARIABLE:
193
                    return this.name;
194
                case PARAMETER_TYPE_CONSTANT:
195
                    if (this.value == null) {
196
                        return null;
197
                    }
198
                    return this.value.toString();
199
                default:
200
                    if (this.name != null) {
201
                        return this.name;
202
                    }
203
                    if (this.value != null) {
204
                        return this.value.toString();
205
                    }
206
                    return null;
207
            }
208
        }
209

    
210
        @Override
211
        public int type() {
212
            return this.type;
213
        }
214

    
215
        @Override
216
        public boolean is_constant() {
217
            return this.type == PARAMETER_TYPE_CONSTANT;
218
        }
219

    
220
        @Override
221
        public boolean is_variable() {
222
            return this.type == PARAMETER_TYPE_VARIABLE;
223
        }
224

    
225
        @Override
226
        public GeometryParameter as_geometry_variable() {
227
            this.type = PARAMETER_TYPE_GEOMETRY;
228
            if (this.value == null && this.name != null) {
229
                this.value = this.name;
230
            }
231
            return this;
232
        }
233
        
234
        @Override
235
        public boolean is_geometry_variable() {
236
            return this.type == PARAMETER_TYPE_GEOMETRY;
237
        }
238

    
239
        @Override
240
        public Object value() {
241
            try {
242
                switch (this.type) {
243
                    case PARAMETER_TYPE_CONSTANT:
244
                        if( this.value instanceof Geometry ) {
245
                            switch (this.builder.geometry_support_type()) {
246
                                case NATIVE:
247
                                    return GeometryUtils.toEWKB(this.geometry());
248
                                case EWKB:
249
                                    return GeometryUtils.toEWKB(this.geometry());
250
                                case WKB:
251
                                    return GeometryUtils.toWKB(this.geometry());
252
                                case WKT:
253
                                default:
254
                                    return GeometryUtils.toWKT(this.geometry());
255
                            }
256
                        }
257
                        if( this.value instanceof IProjection ) {
258
                            return this.builder.srs_id((IProjection) this.value);
259
                        }
260
                        return this.value;
261
                    case PARAMETER_TYPE_VARIABLE:
262
                    case PARAMETER_TYPE_GEOMETRY:
263
                    default:
264
                        return this.value;
265
                }
266
            } catch (Exception ex) {
267
                throw new RuntimeException("Can't get value from parameter.", ex);
268
            }
269
        }
270
        
271
        @Override
272
        public String toString() {
273
          return this.toString(this.builder.builder().formatter()); 
274
        }
275

    
276
        @Override
277
        public String toString(Formatter<Value> formatter) {
278
            if( formatter!=null && formatter.canApply(this) ) {
279
                return formatter.format(this);
280
            }
281
            switch (this.type) {
282
                case PARAMETER_TYPE_CONSTANT:
283
                        if( this.value instanceof Geometry ) {
284
                            switch (this.builder.geometry_support_type()) {
285
                                case EWKB:
286
                                    return MessageFormat.format(
287
                                        FORMAT_ST_GEOMFROMEWKB,
288
                                        "?",
289
                                        this.getSRS(formatter)
290
                                    );
291
                                case WKB:
292
                                    return MessageFormat.format(
293
                                        FORMAT_ST_GEOMFROMWKB,
294
                                        "?",
295
                                        this.getSRS(formatter)
296
                                    );
297
                                case NATIVE:
298
                                    return MessageFormat.format("DECODE('{0}','hex')",
299
                                            this.builder.builder().bytearray_hex(
300
                                                GeometryUtils.toEWKB((Geometry) this.value)
301
                                            )
302
                                    );
303
                                case WKT:
304
                                default:
305
                                    return MessageFormat.format(
306
                                        FORMAT_ST_GEOMFROMTEXT,
307
                                        "?",
308
                                        this.getSRS(formatter)
309
                                    );
310
                            }
311
                        }
312
                case PARAMETER_TYPE_VARIABLE:
313
                default:
314
                    return "?";
315
                case PARAMETER_TYPE_GEOMETRY:
316
                    switch (this.builder.geometry_support_type()) {
317
                        case EWKB:
318
                            return MessageFormat.format(
319
                                FORMAT_ST_GEOMFROMEWKB,
320
                                "?",
321
                                getSRS(formatter)
322
                            );
323
                        case WKB:
324
                            return MessageFormat.format(
325
                                FORMAT_ST_GEOMFROMWKB,
326
                                "?",
327
                                getSRS(formatter)
328
                            );
329
                        case NATIVE:
330
                            return "?";
331
                        case WKT:
332
                        default:
333
                            return MessageFormat.format(
334
                                FORMAT_ST_GEOMFROMTEXT,
335
                                "?",
336
                                getSRS(formatter)
337
                            );
338
                    }
339
            }
340
        }
341

    
342
        private String getSRS(Formatter formatter) {
343
            if( this.srs!=null ) {
344
                return this.srs.toString(formatter);
345
            }
346
            if( this.value instanceof Geometry ) {
347
                IProjection proj = ((Geometry)this.value).getProjection();
348
                Object s = this.builder.srs_id(proj);
349
                if( s == null ) {
350
                    throw new IllegalArgumentException("A parameter of type Geometry with an invalid SRS.");
351
                }
352
                return s.toString();
353
            }
354
            throw new IllegalArgumentException("The parameter of type Geometry need a SRS.");
355
        }
356

    
357
    }
358

    
359
//    
360
//    public static class ProjectionParameterBase 
361
//            extends ParameterBase 
362
//            implements Parameter {
363
//        
364
//        protected GeometryExpressionBuilderHelper builder;
365
//
366
//        public ProjectionParameterBase(GeometryExpressionBuilderHelper builder) {
367
//            this.builder = builder;
368
//        }
369
//
370
//        @Override
371
//        public Parameter value(Object value) {
372
//            if( !(value instanceof IProjection) ) {
373
//                throw new IllegalArgumentException("Only IProjection are allowed.");
374
//            }
375
//            return super.value(value);
376
//        }
377
//
378
//        @Override
379
//        public Object value() {
380
//            try {
381
//                switch (this.type) {
382
//                    case PARAMETER_TYPE_CONSTANT:
383
//                        return this.builder.srs_id((IProjection) this.value);
384
//                    case PARAMETER_TYPE_VARIABLE:
385
//                    default:
386
//                        return this.value;
387
//                }
388
//            } catch (Exception ex) {
389
//                throw new RuntimeException("Can't get value from parameter.", ex);
390
//            }
391
//        }        
392
//    }
393
    
394
    public static class GeometryConstant extends AbstractValue implements Constant {
395

    
396
        protected Geometry geometry;
397
        protected GeometryExpressionBuilderHelper builder;
398
        
399
        public GeometryConstant(GeometryExpressionBuilderHelper builder, Geometry geometry) {
400
            this.builder = builder;
401
            this.geometry = geometry;
402
        }
403

    
404
        @Override
405
        public String toString() {
406
          return this.toString(builder.builder().formatter()); 
407
        }
408

    
409
        @Override
410
        public String toString(Formatter<Value> formatter) {
411
            if( formatter!=null && formatter.canApply(this) ) {
412
                return formatter.format(this);
413
            }
414
            try {
415
                switch (this.builder.geometry_support_type()) {
416
                    case EWKB:
417
                        return MessageFormat.format(
418
                                FORMAT_ST_GEOMFROMEWKB,
419
                                "DECODE('"+this.builder.builder().bytearray_hex(GeometryUtils.toEWKB(geometry))+"','hex')",
420
                                this.getSRS()
421
                        );
422
                    case WKB:
423
                        return MessageFormat.format(
424
                                FORMAT_ST_GEOMFROMWKB,
425
                                "DECODE('"+this.builder.builder().bytearray_hex(GeometryUtils.toWKB(geometry))+"','hex')",
426
                                this.getSRS()
427
                        );
428
                    case NATIVE:
429
                        return MessageFormat.format("DECODE('{0}','hex')",
430
                                this.builder.builder().bytearray_hex(
431
                                    GeometryUtils.toEWKB((Geometry) geometry)
432
                                )
433
                        );
434
                    case WKT:
435
                    default:
436
                        return MessageFormat.format(
437
                                FORMAT_ST_GEOMFROMTEXT,
438
                                this.builder.builder().string(GeometryUtils.toWKT(geometry)),
439
                                this.getSRS()
440
                        );
441
                }
442
            } catch(Throwable th) {
443
                throw th;
444
            }
445
        }
446

    
447
        @Override
448
        public Object value() {
449
            return this.geometry;
450
        }
451

    
452
        private String getSRS() {
453
            IProjection proj = this.geometry.getProjection();
454
            Object s = this.builder.srs_id(proj);
455
            if( s == null ) {
456
                throw new IllegalArgumentException("A parameter of type Geometry with an invalid SRS.");
457
            }
458
            return s.toString();
459
        }
460

    
461
    }
462

    
463
    public static class ProjectionConstant extends AbstractValue implements Constant {
464

    
465
        protected IProjection projection;
466
        protected GeometryExpressionBuilderHelper builder;
467
        
468
        public ProjectionConstant(GeometryExpressionBuilderHelper builder, IProjection projection) {
469
            this.projection = projection;
470
            this.builder = builder;
471
        }
472

    
473
        @Override
474
        public String toString() {
475
          return this.toString(this.builder.builder().formatter()); 
476
        }
477

    
478
        @Override
479
        public String toString(Formatter<Value> formatter) {
480
            if( formatter!=null && formatter.canApply(this) ) {
481
                return formatter.format(this);
482
            }
483
            return Objects.toString(this.builder.srs_id(this.projection));
484
        }
485

    
486
        @Override
487
        public Object value() {
488
            return this.projection;
489
        }
490

    
491
    }
492

    
493
    protected GeometrySupportType geometrySupportType;
494
    protected ExpressionBuilder builder;
495

    
496
    public DefaultGeometryExpressionBuilderHelper(ExpressionBuilder builder) {
497
        this.builder = builder;
498
        this.geometrySupportType = GeometrySupportType.WKB;
499
    }
500
    
501
    public DefaultGeometryExpressionBuilderHelper() {
502
        this.geometrySupportType = GeometrySupportType.WKB;
503
    }
504

    
505
    @Override
506
    public ExpressionBuilder builder() {
507
        return this.builder;
508
    }
509
    
510
    @Override
511
    public GeometrySupportType geometry_support_type() {
512
        return this.geometrySupportType;
513
    }
514

    
515
    @Override
516
    public GeometryExpressionBuilderHelper geometry_support_type(GeometrySupportType geometrySupportType) {
517
        this.geometrySupportType = geometrySupportType;
518
        return this;
519
    }
520
    
521
    @Override
522
    public Object srs_id(IProjection projection) {
523
        if( projection==null ) {
524
            return 0;
525
        }
526
        return ProjectionUtils.getCode(projection);
527
    }
528

    
529
    @Override
530
    public Constant srs(IProjection projection) {
531
        if( projection == null ) {
532
            return this.builder.constant(null);
533
        }
534
        return new ProjectionConstant(this, projection);
535
    }
536

    
537
    @Override
538
    public Constant geometry(Geometry geom, IProjection projection) {
539
        if( geom == null ) {
540
            return this.builder.constant(null);
541
        }
542
        geom.setProjection(projection);
543
        return new GeometryConstant(this, geom);
544
    }
545

    
546
    @Override
547
    public Constant geometry(Geometry geom) {
548
        if( geom == null ) {
549
            return this.builder.constant(null);
550
        }
551
        if( geom.getProjection()==null ) {
552
            throw new IllegalArgumentException("The geometry does not have an associated projection. Use 'geometry(Geometry, IProjection)'.");
553
        }
554
        return new GeometryConstant(this, geom);
555
    }
556

    
557
    @Override
558
    public Constant envelope(Envelope envelope, IProjection projection) {
559
        if( envelope == null ) {
560
            return this.builder.constant(null);
561
        }
562
        Geometry geom = envelope.getGeometry();
563
        geom.setProjection(projection);
564
        return new GeometryConstant(this, geom);
565
    }
566

    
567
    @Override
568
    public Constant envelope(Envelope envelope) {
569
        if( envelope == null ) {
570
            return this.builder.constant(null);
571
        }
572
        if( envelope.getProjection()==null ) {
573
            throw new IllegalArgumentException("The envelope does not have an associated projection. Use 'envelope(Geometry, IProjection)'.");
574
        }
575
        Geometry geom = envelope.getGeometry();
576
        return new GeometryConstant(this, geom);
577
    }
578

    
579
    @Override
580
    public GeometryParameter parameter() {
581
        GeometryParameterBase p = new GeometryParameterBase(this);
582
        return p;
583
    }
584

    
585
    @Override
586
    public GeometryParameter parameter(String name) {
587
        GeometryParameterBase p = new GeometryParameterBase(this);
588
        p.name(name);
589
        return p;
590
    }
591

    
592
    @Override
593
    public GeometryParameter parameter(Object value) {
594
        GeometryParameterBase p = new GeometryParameterBase(this);
595
        p.value(value);
596
        return p;
597
    }
598

    
599
    public Function builtin_function(String name, String format, Value... values) {
600
        Function func = this.builder.function(name, values);
601
        func.format(format);
602
        return func;
603
    }    
604
    
605
    public Function function(String name, Value... values) {
606
        Function func = this.builder.function(name, values);
607
        return func;
608
    }    
609
    
610
    @Override
611
    public Function as_geometry(Value value) {
612
        return builtin_function(FUNCTION_ST_ASBINARY, FORMAT_ST_ASBINARY, value);
613
    }
614

    
615
    @Override
616
    public Function ST_Intersects(Value geom1, Value geom2) {
617
        return builtin_function(FUNCTION_ST_INTERSECTS, FORMAT_ST_INTERSECTS, geom1, geom2);
618
    }
619

    
620
    @Override
621
    public Function ST_SRID(Value geom) {
622
        return builtin_function(FUNCTION_ST_SRID, FORMAT_ST_SRID, geom);
623
    }
624

    
625
    @Override
626
    public Function ST_Envelope(Value geom) {
627
        return builtin_function(FUNCTION_ST_ENVELOPE, FORMAT_ST_ENVELOPE, geom);
628
    }
629

    
630
    @Override
631
    public Function ST_Force2D(Value geom) {
632
        return builtin_function(FUNCTION_ST_FORCE2D, FORMAT_ST_FORCE2D, geom);
633
    }
634

    
635
    @Override
636
    public Function ST_AsText(Value geom) {
637
        return builtin_function(FUNCTION_ST_ASTEXT, FORMAT_ST_ASTEXT, geom);
638
    }
639

    
640
    @Override
641
    public Function ST_AsBinary(Value geom) {
642
        return builtin_function(FUNCTION_ST_ASBINARY, FORMAT_ST_ASBINARY, geom);
643
    }
644

    
645
    @Override
646
    public Function ST_AsEWKB(Value geom) {
647
        return builtin_function(FUNCTION_ST_ASEWKB, FORMAT_ST_ASEWKB, geom);
648
    }
649

    
650
    @Override
651
    public Function ST_GeomFromText(Value geom, Value crs) {
652
        return builtin_function(FUNCTION_ST_GEOMFROMTEXT, FORMAT_ST_GEOMFROMTEXT, geom, crs);
653
    }
654

    
655
    @Override
656
    public Function ST_GeomFromWKB(Value geom, Value crs) {
657
        return builtin_function(FUNCTION_ST_GEOMFROMWKB, FORMAT_ST_GEOMFROMWKB, geom, crs);
658
    }
659

    
660
    @Override
661
    public Function ST_GeomFromEWKB(Value geom, Value crs) {
662
        return builtin_function(FUNCTION_ST_GEOMFROMEWKB, FORMAT_ST_GEOMFROMEWKB, geom, crs);
663
    }
664

    
665
    @Override
666
    public Function ST_Simplify(Value geom, Value tolerance) {
667
        return builtin_function(FUNCTION_ST_SIMPLIFY, FORMAT_ST_SIMPLIFY, tolerance);
668
    }
669

    
670
    @Override
671
    public Function ST_Disjoint(Value geom1, Value geom2) {
672
        return builtin_function(FUNCTION_ST_DISJOINT, FORMAT_ST_DISJOINT, geom1, geom2);
673
    }
674

    
675
    @Override
676
    public Function ST_Contains(Value geom1, Value geom2) {
677
        return builtin_function(FUNCTION_ST_CONTAINS, FORMAT_ST_CONTAINS, geom1, geom2);
678
    }
679

    
680
    @Override
681
    public Function ST_Equals(Value geom1, Value geom2) {
682
        return builtin_function(FUNCTION_ST_EQUALS, FORMAT_ST_EQUALS, geom1, geom2);
683
    }
684

    
685
    @Override
686
    public Function ST_Crosses(Value geom1, Value geom2) {
687
        return builtin_function(FUNCTION_ST_CROSSES, FORMAT_ST_CROSSES, geom1, geom2);
688
    }
689

    
690
    @Override
691
    public Function ST_IsClosed(Value geom) {
692
        return builtin_function(FUNCTION_ST_ISCLOSED, FORMAT_ST_ISCLOSED, geom);
693
    }
694

    
695
    @Override
696
    public Function ST_Overlaps(Value geom1, Value geom2) {
697
        return builtin_function(FUNCTION_ST_OVERLAPS, FORMAT_ST_OVERLAPS, geom1, geom2);
698
    }
699

    
700
    @Override
701
    public Function ST_Touches(Value geom1, Value geom2) {
702
        return builtin_function(FUNCTION_ST_TOUCHES, FORMAT_ST_TOUCHES, geom1, geom2);
703
    }
704

    
705
    @Override
706
    public Function ST_Within(Value geom1, Value geom2) {
707
        return builtin_function("ST_Within", FORMAT_ST_WITHIN, geom1, geom2);
708
    }
709

    
710
    @Override
711
    public Function ST_Area(Value geom) {
712
        return function("ST_Area", geom);
713
    }
714

    
715
    @Override
716
    public Function ST_Buffer(Value geom) {
717
        return function("ST_Buffer", geom);
718
    }
719

    
720
    @Override
721
    public Function ST_Buffer(Value geom, Value dist) {
722
        return function("ST_Buffer", geom, dist);
723
    }
724

    
725
    @Override
726
    public Function ST_Centroid(Value geom) {
727
        return function("ST_Centroid", geom);
728
    }
729

    
730
    @Override
731
    public Function ST_CoveredBy(Value geom1, Value geom2) {
732
        return function("ST_CoveredBy", geom1, geom2);
733
    }
734

    
735
    @Override
736
    public Function ST_Covers(Value geom1, Value geom2) {
737
        return function("ST_Covers", geom1, geom2);
738
    }
739

    
740
    @Override
741
    public Function ST_Diference(Value geom1, Value geom2) {
742
        return function("ST_Diference", geom1, geom2);
743
    }
744

    
745
    @Override
746
    public Function ST_Dimension(Value geom) {
747
        return function("ST_Dimension", geom);
748
    }
749

    
750
    @Override
751
    public Function ST_Distance(Value geom1, Value geom2) {
752
        return function("ST_Distance", geom1, geom2);
753
    }
754

    
755
    @Override
756
    public Function ST_EndPoint(Value geom) {
757
        return function("ST_EndPoint", geom);
758
    }
759

    
760
    @Override
761
    public Function ST_Intersection(Value geom1, Value geom2) {
762
        return function("ST_Intersection", geom1, geom2);
763
    }
764

    
765
    @Override
766
    public Function ST_IsSimple(Value geom) {
767
        return function("ST_IsSimple", geom);
768
    }
769

    
770
    @Override
771
    public Function ST_IsValid(Value geom) {
772
        return function("ST_IsValid", geom);
773
    }
774

    
775
    @Override
776
    public Function ST_NumGeometries(Value geom) {
777
        return function("ST_NumGeometries", geom);
778
    }
779

    
780
    @Override
781
    public Function ST_NumPoints(Value geom) {
782
        return function("ST_NumPoints", geom);
783
    }
784

    
785
    @Override
786
    public Function ST_Perimeter(Value geom) {
787
        return function("ST_Perimeter", geom);
788
    }
789

    
790
    @Override
791
    public Function ST_PointN(Value geom, Value n) {
792
        return function("ST_PointN", geom, n);
793
    }
794

    
795
    @Override
796
    public Function ST_StartPoint(Value geom) {
797
        return function("ST_StartPoint", geom);
798
    }
799

    
800
    @Override
801
    public Function ST_Union(Value geom1, Value geom2) {
802
        return function("ST_Union", geom1, geom2);
803
    }
804

    
805
    @Override
806
    public Function ST_X(Value geom) {
807
        return function("ST_X", geom);
808
    }
809

    
810
    @Override
811
    public Function ST_Y(Value geom) {
812
        return function("ST_Y", geom);
813
    }
814

    
815
    @Override
816
    public Function ST_Z(Value geom) {
817
        return function("ST_Z", geom);
818
    }
819

    
820
    @Override
821
    public Function ST_ExtentAggregate(Value geom) {
822
       return function(FUNCTION_ST_EXTENTAGGREGATE, geom);
823
    }
824

    
825
    @Override
826
    public Function ST_UnionAggregate(Value geom) {
827
       return function(FUNCTION_ST_UNIONAGGREGATE, geom);
828
    }
829

    
830
    @Override
831
    public Function ST_Point(Value x, Value y) {
832
       return function(FUNCTION_ST_POINT, x, y);
833
    }
834

    
835
    @Override
836
    public Function ST_MakePoint(Value x, Value y) {
837
       return function(FUNCTION_ST_MAKEPOINT, x, y);
838
    }
839

    
840
    @Override
841
    public Function ST_MakePoint(Value x, Value y, Value z) {
842
       return function(FUNCTION_ST_MAKEPOINT, x, y, z);
843
    }
844

    
845
    @Override
846
    public Function ST_MakePoint(Value x, Value y, Value z, Value m) {
847
       return function(FUNCTION_ST_MAKEPOINT, x, y, z, m);
848
    }
849

    
850
    @Override
851
    public Function ST_SetSRID(Value geom, Value srid) {
852
       return function(FUNCTION_ST_POINT, geom, srid);
853
    }
854
    
855
}