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

History | View | Annotate | Download (27.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 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
            boolean visitChildren = true;
82
            if (filter==null || filter.accept(this)) {
83
                visitor.visit(this);
84
            } else {
85
                visitChildren = !filter.skipChildren();
86
            }
87
            if(visitChildren){
88
                if (this.srs != null) {
89
                    this.srs.accept(visitor, filter);
90
                }
91
            }
92
        }
93

    
94
        @Override
95
        public void replace(Value target, Value replacement) {
96
            if( this.srs == target ) {
97
                this.srs = replacement;
98
            } else {
99
                this.srs.replace(target, replacement);
100
            }
101
        }
102

    
103
        @Override
104
        public GeometryParameter value(Object value) {
105
            if( value instanceof Geometry ) {
106
                if( this.srs == null ) {
107
                    IProjection proj = ((Geometry)value).getProjection();
108
                    this.srs(this.builder.parameter().value(proj));
109
                }
110
            }
111
            this.value = value;
112
            return this;
113
        }
114

    
115
        @Override
116
        public GeometryParameter srs(IProjection srs) {
117
            this.srs = new ProjectionConstant(this.builder, srs);
118
            if( this.type == PARAMETER_TYPE_VARIABLE ) {
119
                this.type = PARAMETER_TYPE_GEOMETRY;
120
            }
121
            return this;
122
        }
123

    
124
        @Override
125
        public GeometryParameter srs(Value srs) {
126
            this.srs = srs;
127
            if( this.type == PARAMETER_TYPE_VARIABLE ) {
128
                this.type = PARAMETER_TYPE_GEOMETRY;
129
            }
130
            return this;
131
        }
132

    
133
        @Override
134
        public Value srs() {
135
            return this.srs;
136
        }
137

    
138
        @Override
139
        public Geometry geometry() {
140
            return (Geometry) this.value;
141
        }
142

    
143

    
144
        @Override
145
        public GeometryParameter as_constant() {
146
            this.type = PARAMETER_TYPE_CONSTANT;
147
            if (this.value == null && this.name != null) {
148
                this.value = this.name;
149
            }
150
            return this;
151
        }
152

    
153
        @Override
154
        public GeometryParameter as_variable() {
155
            this.type = PARAMETER_TYPE_VARIABLE;
156
            if (this.value != null && this.name == null) {
157
                this.name = (String) this.value;
158
            }
159
            return this;
160
        }
161

    
162
        @Override
163
        public GeometryParameter name(String name) {
164
            this.type = PARAMETER_TYPE_VARIABLE;
165
            this.name = name;
166
            return this;
167
        }
168
        
169
        @Override
170
        public String name() {
171
            switch (this.type) {
172
                case PARAMETER_TYPE_VARIABLE:
173
                    return this.name;
174
                case PARAMETER_TYPE_CONSTANT:
175
                    if (this.value == null) {
176
                        return null;
177
                    }
178
                    return this.value.toString();
179
                default:
180
                    if (this.name != null) {
181
                        return this.name;
182
                    }
183
                    if (this.value != null) {
184
                        return this.value.toString();
185
                    }
186
                    return null;
187
            }
188
        }
189

    
190
        @Override
191
        public int type() {
192
            return this.type;
193
        }
194

    
195
        @Override
196
        public boolean is_constant() {
197
            return this.type == PARAMETER_TYPE_CONSTANT;
198
        }
199

    
200
        @Override
201
        public boolean is_variable() {
202
            return this.type == PARAMETER_TYPE_VARIABLE;
203
        }
204

    
205
        @Override
206
        public GeometryParameter as_geometry_variable() {
207
            this.type = PARAMETER_TYPE_GEOMETRY;
208
            if (this.value == null && this.name != null) {
209
                this.value = this.name;
210
            }
211
            return this;
212
        }
213
        
214
        @Override
215
        public boolean is_geometry_variable() {
216
            return this.type == PARAMETER_TYPE_GEOMETRY;
217
        }
218

    
219
        @Override
220
        public Object value() {
221
            try {
222
                switch (this.type) {
223
                    case PARAMETER_TYPE_CONSTANT:
224
                        if( this.value instanceof Geometry ) {
225
                            switch (this.builder.geometry_support_type()) {
226
                                case EWKB:
227
                                    return GeometryUtils.toEWKB(this.geometry());
228
                                case WKB:
229
                                    return GeometryUtils.toWKB(this.geometry());
230
                                case WKT:
231
                                default:
232
                                    return GeometryUtils.toWKT(this.geometry());
233
                            }
234
                        }
235
                        if( this.value instanceof IProjection ) {
236
                            return this.builder.srs_id((IProjection) this.value);
237
                        }
238
                        return this.value;
239
                    case PARAMETER_TYPE_VARIABLE:
240
                    case PARAMETER_TYPE_GEOMETRY:
241
                    default:
242
                        return this.value;
243
                }
244
            } catch (Exception ex) {
245
                throw new RuntimeException("Can't get value from parameter.", ex);
246
            }
247
        }
248
        
249
        @Override
250
        public String toString() {
251
          return this.toString(this.builder.builder().formatter()); 
252
        }
253

    
254
        @Override
255
        public String toString(Formatter<Value> formatter) {
256
            if( formatter!=null && formatter.canApply(this) ) {
257
                return formatter.format(this);
258
            }
259
            switch (this.type) {
260
                case PARAMETER_TYPE_CONSTANT:
261
                        if( this.value instanceof Geometry ) {
262
                            switch (this.builder.geometry_support_type()) {
263
                                case EWKB:
264
                                    return MessageFormat.format(
265
                                        FORMAT_ST_GEOMFROMEWKB,
266
                                        "?",
267
                                        this.getSRS(formatter)
268
                                    );
269
                                case WKB:
270
                                    return MessageFormat.format(
271
                                        FORMAT_ST_GEOMFROMWKB,
272
                                        "?",
273
                                        this.getSRS(formatter)
274
                                    );
275
                                case WKT:
276
                                default:
277
                                    return MessageFormat.format(
278
                                        FORMAT_ST_GEOMFROMTEXT,
279
                                        "?",
280
                                        this.getSRS(formatter)
281
                                    );
282
                            }
283
                        }
284
                case PARAMETER_TYPE_VARIABLE:
285
                default:
286
                    return "?";
287
                case PARAMETER_TYPE_GEOMETRY:
288
                    switch (this.builder.geometry_support_type()) {
289
                        case EWKB:
290
                            return MessageFormat.format(
291
                                FORMAT_ST_GEOMFROMEWKB,
292
                                "?",
293
                                getSRS(formatter)
294
                            );
295
                        case WKB:
296
                            return MessageFormat.format(
297
                                FORMAT_ST_GEOMFROMWKB,
298
                                "?",
299
                                getSRS(formatter)
300
                            );
301
                        case WKT:
302
                        default:
303
                            return MessageFormat.format(
304
                                FORMAT_ST_GEOMFROMTEXT,
305
                                "?",
306
                                getSRS(formatter)
307
                            );
308
                    }
309
            }
310
        }
311

    
312
        private String getSRS(Formatter formatter) {
313
            if( this.srs!=null ) {
314
                return this.srs.toString(formatter);
315
            }
316
            if( this.value instanceof Geometry ) {
317
                IProjection proj = ((Geometry)this.value).getProjection();
318
                Object s = this.builder.srs_id(proj);
319
                if( s == null ) {
320
                    throw new IllegalArgumentException("A parameter of type Geometry with an invalid SRS.");
321
                }
322
                return s.toString();
323
            }
324
            throw new IllegalArgumentException("The parameter of type Geometry need a SRS.");
325
        }
326

    
327
    }
328

    
329
//    
330
//    public static class ProjectionParameterBase 
331
//            extends ParameterBase 
332
//            implements Parameter {
333
//        
334
//        protected GeometryExpressionBuilderHelper builder;
335
//
336
//        public ProjectionParameterBase(GeometryExpressionBuilderHelper builder) {
337
//            this.builder = builder;
338
//        }
339
//
340
//        @Override
341
//        public Parameter value(Object value) {
342
//            if( !(value instanceof IProjection) ) {
343
//                throw new IllegalArgumentException("Only IProjection are allowed.");
344
//            }
345
//            return super.value(value);
346
//        }
347
//
348
//        @Override
349
//        public Object value() {
350
//            try {
351
//                switch (this.type) {
352
//                    case PARAMETER_TYPE_CONSTANT:
353
//                        return this.builder.srs_id((IProjection) this.value);
354
//                    case PARAMETER_TYPE_VARIABLE:
355
//                    default:
356
//                        return this.value;
357
//                }
358
//            } catch (Exception ex) {
359
//                throw new RuntimeException("Can't get value from parameter.", ex);
360
//            }
361
//        }        
362
//    }
363
    
364
    public static class GeometryConstant extends AbstractValue implements Constant {
365

    
366
        protected Geometry geometry;
367
        protected GeometryExpressionBuilderHelper builder;
368
        
369
        public GeometryConstant(GeometryExpressionBuilderHelper builder, Geometry geometry) {
370
            this.builder = builder;
371
            this.geometry = geometry;
372
        }
373

    
374
        @Override
375
        public String toString() {
376
          return this.toString(builder.builder().formatter()); 
377
        }
378

    
379
        @Override
380
        public String toString(Formatter<Value> formatter) {
381
            if( formatter!=null && formatter.canApply(this) ) {
382
                return formatter.format(this);
383
            }
384
            try {
385
                switch (this.builder.geometry_support_type()) {
386
                    case EWKB:
387
                        return MessageFormat.format(
388
                                FORMAT_ST_GEOMFROMEWKB,
389
                                "DECODE('"+this.builder.builder().bytearray_hex(GeometryUtils.toEWKB(geometry))+"','hex')",
390
                                this.getSRS()
391
                        );
392
                    case WKB:
393
                        return MessageFormat.format(
394
                                FORMAT_ST_GEOMFROMWKB,
395
                                "DECODE('"+this.builder.builder().bytearray_hex(GeometryUtils.toWKB(geometry))+"','hex')",
396
                                this.getSRS()
397
                        );
398
                    case WKT:
399
                    default:
400
                        return MessageFormat.format(
401
                                FORMAT_ST_GEOMFROMTEXT,
402
                                this.builder.builder().string(GeometryUtils.toWKT(geometry)),
403
                                this.getSRS()
404
                        );
405
                }
406
            } catch(Throwable th) {
407
                throw th;
408
            }
409
        }
410

    
411
        @Override
412
        public Object value() {
413
            return this.geometry;
414
        }
415

    
416
        private String getSRS() {
417
            IProjection proj = this.geometry.getProjection();
418
            Object s = this.builder.srs_id(proj);
419
            if( s == null ) {
420
                throw new IllegalArgumentException("A parameter of type Geometry with an invalid SRS.");
421
            }
422
            return s.toString();
423
        }
424

    
425
    }
426

    
427
    public static class ProjectionConstant extends AbstractValue implements Constant {
428

    
429
        protected IProjection projection;
430
        protected GeometryExpressionBuilderHelper builder;
431
        
432
        public ProjectionConstant(GeometryExpressionBuilderHelper builder, IProjection projection) {
433
            this.projection = projection;
434
            this.builder = builder;
435
        }
436

    
437
        @Override
438
        public String toString() {
439
          return this.toString(this.builder.builder().formatter()); 
440
        }
441

    
442
        @Override
443
        public String toString(Formatter<Value> formatter) {
444
            if( formatter!=null && formatter.canApply(this) ) {
445
                return formatter.format(this);
446
            }
447
            return Objects.toString(this.builder.srs_id(this.projection));
448
        }
449

    
450
        @Override
451
        public Object value() {
452
            return this.projection;
453
        }
454

    
455
    }
456

    
457
    protected GeometrySupportType geometrySupportType;
458
    protected ExpressionBuilder builder;
459

    
460
    public DefaultGeometryExpressionBuilderHelper(ExpressionBuilder builder) {
461
        this.builder = builder;
462
        this.geometrySupportType = GeometrySupportType.WKB;
463
    }
464
    
465
    public DefaultGeometryExpressionBuilderHelper() {
466
        this.geometrySupportType = GeometrySupportType.WKB;
467
    }
468

    
469
    @Override
470
    public ExpressionBuilder builder() {
471
        return this.builder;
472
    }
473
    
474
    @Override
475
    public GeometrySupportType geometry_support_type() {
476
        return this.geometrySupportType;
477
    }
478

    
479
    @Override
480
    public GeometryExpressionBuilderHelper geometry_support_type(GeometrySupportType geometrySupportType) {
481
        this.geometrySupportType = geometrySupportType;
482
        return this;
483
    }
484
    
485
    @Override
486
    public Object srs_id(IProjection projection) {
487
        if( projection==null ) {
488
            return 0;
489
        }
490
        return ProjectionUtils.getCode(projection);
491
    }
492

    
493
    @Override
494
    public Constant srs(IProjection projection) {
495
        if( projection == null ) {
496
            return this.builder.constant(null);
497
        }
498
        return new ProjectionConstant(this, projection);
499
    }
500

    
501
    @Override
502
    public Constant geometry(Geometry geom, IProjection projection) {
503
        if( geom == null ) {
504
            return this.builder.constant(null);
505
        }
506
        geom.setProjection(projection);
507
        return new GeometryConstant(this, geom);
508
    }
509

    
510
    @Override
511
    public Constant geometry(Geometry geom) {
512
        if( geom == null ) {
513
            return this.builder.constant(null);
514
        }
515
        if( geom.getProjection()==null ) {
516
            throw new IllegalArgumentException("The geometry does not have an associated projection. Use 'geometry(Geometry, IProjection)'.");
517
        }
518
        return new GeometryConstant(this, geom);
519
    }
520

    
521
    @Override
522
    public Constant envelope(Envelope envelope, IProjection projection) {
523
        if( envelope == null ) {
524
            return this.builder.constant(null);
525
        }
526
        Geometry geom = envelope.getGeometry();
527
        geom.setProjection(projection);
528
        return new GeometryConstant(this, geom);
529
    }
530

    
531
    @Override
532
    public Constant envelope(Envelope envelope) {
533
        if( envelope == null ) {
534
            return this.builder.constant(null);
535
        }
536
        if( envelope.getProjection()==null ) {
537
            throw new IllegalArgumentException("The envelope does not have an associated projection. Use 'envelope(Geometry, IProjection)'.");
538
        }
539
        Geometry geom = envelope.getGeometry();
540
        return new GeometryConstant(this, geom);
541
    }
542

    
543
    @Override
544
    public GeometryParameter parameter() {
545
        GeometryParameterBase p = new GeometryParameterBase(this);
546
        return p;
547
    }
548

    
549
    @Override
550
    public GeometryParameter parameter(String name) {
551
        GeometryParameterBase p = new GeometryParameterBase(this);
552
        p.name(name);
553
        return p;
554
    }
555

    
556
    @Override
557
    public GeometryParameter parameter(Object value) {
558
        GeometryParameterBase p = new GeometryParameterBase(this);
559
        p.value(value);
560
        return p;
561
    }
562

    
563
    public Function builtin_function(String name, String format, Value... values) {
564
        Function func = this.builder.function(name, values);
565
        func.format(format);
566
        return func;
567
    }    
568
    
569
    public Function function(String name, Value... values) {
570
        Function func = this.builder.function(name, values);
571
        return func;
572
    }    
573
    
574
    @Override
575
    public Function as_geometry(Value value) {
576
        return builtin_function(FUNCTION_ST_ASBINARY, FORMAT_ST_ASBINARY, value);
577
    }
578

    
579
    @Override
580
    public Function ST_Intersects(Value geom1, Value geom2) {
581
        return builtin_function(FUNCTION_ST_INTERSECTS, FORMAT_ST_INTERSECTS, geom1, geom2);
582
    }
583

    
584
    @Override
585
    public Function ST_SRID(Value geom) {
586
        return builtin_function(FUNCTION_ST_SRID, FORMAT_ST_SRID, geom);
587
    }
588

    
589
    @Override
590
    public Function ST_Envelope(Value geom) {
591
        return builtin_function(FUNCTION_ST_ENVELOPE, FORMAT_ST_ENVELOPE, geom);
592
    }
593

    
594
    @Override
595
    public Function ST_Force2D(Value geom) {
596
        return builtin_function(FUNCTION_ST_FORCE2D, FORMAT_ST_FORCE2D, geom);
597
    }
598

    
599
    @Override
600
    public Function ST_AsText(Value geom) {
601
        return builtin_function(FUNCTION_ST_ASTEXT, FORMAT_ST_ASTEXT, geom);
602
    }
603

    
604
    @Override
605
    public Function ST_AsBinary(Value geom) {
606
        return builtin_function(FUNCTION_ST_ASBINARY, FORMAT_ST_ASBINARY, geom);
607
    }
608

    
609
    @Override
610
    public Function ST_AsEWKB(Value geom) {
611
        return builtin_function(FUNCTION_ST_ASEWKB, FORMAT_ST_ASEWKB, geom);
612
    }
613

    
614
    @Override
615
    public Function ST_GeomFromText(Value geom, Value crs) {
616
        return builtin_function(FUNCTION_ST_GEOMFROMTEXT, FORMAT_ST_GEOMFROMTEXT, geom, crs);
617
    }
618

    
619
    @Override
620
    public Function ST_GeomFromWKB(Value geom, Value crs) {
621
        return builtin_function(FUNCTION_ST_GEOMFROMWKB, FORMAT_ST_GEOMFROMWKB, geom, crs);
622
    }
623

    
624
    @Override
625
    public Function ST_GeomFromEWKB(Value geom, Value crs) {
626
        return builtin_function(FUNCTION_ST_GEOMFROMEWKB, FORMAT_ST_GEOMFROMEWKB, geom, crs);
627
    }
628

    
629
    @Override
630
    public Function ST_Simplify(Value geom, Value tolerance) {
631
        return builtin_function(FUNCTION_ST_SIMPLIFY, FORMAT_ST_SIMPLIFY, tolerance);
632
    }
633

    
634
    @Override
635
    public Function ST_Disjoint(Value geom1, Value geom2) {
636
        return builtin_function(FUNCTION_ST_DISJOINT, FORMAT_ST_DISJOINT, geom1, geom2);
637
    }
638

    
639
    @Override
640
    public Function ST_Contains(Value geom1, Value geom2) {
641
        return builtin_function(FUNCTION_ST_CONTAINS, FORMAT_ST_CONTAINS, geom1, geom2);
642
    }
643

    
644
    @Override
645
    public Function ST_Equals(Value geom1, Value geom2) {
646
        return builtin_function(FUNCTION_ST_EQUALS, FORMAT_ST_EQUALS, geom1, geom2);
647
    }
648

    
649
    @Override
650
    public Function ST_Crosses(Value geom1, Value geom2) {
651
        return builtin_function(FUNCTION_ST_CROSSES, FORMAT_ST_CROSSES, geom1, geom2);
652
    }
653

    
654
    @Override
655
    public Function ST_IsClosed(Value geom) {
656
        return builtin_function(FUNCTION_ST_ISCLOSED, FORMAT_ST_ISCLOSED, geom);
657
    }
658

    
659
    @Override
660
    public Function ST_Overlaps(Value geom1, Value geom2) {
661
        return builtin_function(FUNCTION_ST_OVERLAPS, FORMAT_ST_OVERLAPS, geom1, geom2);
662
    }
663

    
664
    @Override
665
    public Function ST_Touches(Value geom1, Value geom2) {
666
        return builtin_function(FUNCTION_ST_TOUCHES, FORMAT_ST_TOUCHES, geom1, geom2);
667
    }
668

    
669
    @Override
670
    public Function ST_Within(Value geom1, Value geom2) {
671
        return builtin_function("ST_Within", FORMAT_ST_WITHIN, geom1, geom2);
672
    }
673

    
674
    @Override
675
    public Function ST_Area(Value geom) {
676
        return function("ST_Area", geom);
677
    }
678

    
679
    @Override
680
    public Function ST_Buffer(Value geom) {
681
        return function("ST_Buffer", geom);
682
    }
683

    
684
    @Override
685
    public Function ST_Buffer(Value geom, Value dist) {
686
        return function("ST_Buffer", geom, dist);
687
    }
688

    
689
    @Override
690
    public Function ST_Centroid(Value geom) {
691
        return function("ST_Centroid", geom);
692
    }
693

    
694
    @Override
695
    public Function ST_CoveredBy(Value geom1, Value geom2) {
696
        return function("ST_CoveredBy", geom1, geom2);
697
    }
698

    
699
    @Override
700
    public Function ST_Covers(Value geom1, Value geom2) {
701
        return function("ST_Covers", geom1, geom2);
702
    }
703

    
704
    @Override
705
    public Function ST_Diference(Value geom1, Value geom2) {
706
        return function("ST_Diference", geom1, geom2);
707
    }
708

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

    
714
    @Override
715
    public Function ST_Distance(Value geom1, Value geom2) {
716
        return function("ST_Distance", geom1, geom2);
717
    }
718

    
719
    @Override
720
    public Function ST_EndPoint(Value geom) {
721
        return function("ST_EndPoint", geom);
722
    }
723

    
724
    @Override
725
    public Function ST_Intersection(Value geom1, Value geom2) {
726
        return function("ST_Intersection", geom1, geom2);
727
    }
728

    
729
    @Override
730
    public Function ST_IsSimple(Value geom) {
731
        return function("ST_IsSimple", geom);
732
    }
733

    
734
    @Override
735
    public Function ST_IsValid(Value geom) {
736
        return function("ST_IsValid", geom);
737
    }
738

    
739
    @Override
740
    public Function ST_NumGeometries(Value geom) {
741
        return function("ST_NumGeometries", geom);
742
    }
743

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

    
749
    @Override
750
    public Function ST_Perimeter(Value geom) {
751
        return function("ST_Perimeter", geom);
752
    }
753

    
754
    @Override
755
    public Function ST_PointN(Value geom, Value n) {
756
        return function("ST_PointN", geom, n);
757
    }
758

    
759
    @Override
760
    public Function ST_StartPoint(Value geom) {
761
        return function("ST_StartPoint", geom);
762
    }
763

    
764
    @Override
765
    public Function ST_Union(Value geom1, Value geom2) {
766
        return function("ST_Union", geom1, geom2);
767
    }
768

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

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

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

    
784
    @Override
785
    public Function ST_ExtentAggregate(Value geom) {
786
       return function(FUNCTION_ST_EXTENTAGGREGATE, geom);
787
    }
788

    
789
    @Override
790
    public Function ST_UnionAggregate(Value geom) {
791
       return function(FUNCTION_ST_UNIONAGGREGATE, geom);
792
    }
793

    
794
    @Override
795
    public Function ST_Point(Value x, Value y) {
796
       return function(FUNCTION_ST_POINT, x, y);
797
    }
798

    
799
    @Override
800
    public Function ST_MakePoint(Value x, Value y) {
801
       return function(FUNCTION_ST_MAKEPOINT, x, y);
802
    }
803

    
804
    @Override
805
    public Function ST_MakePoint(Value x, Value y, Value z) {
806
       return function(FUNCTION_ST_MAKEPOINT, x, y, z);
807
    }
808

    
809
    @Override
810
    public Function ST_MakePoint(Value x, Value y, Value z, Value m) {
811
       return function(FUNCTION_ST_MAKEPOINT, x, y, z, m);
812
    }
813

    
814
    @Override
815
    public Function ST_SetSRID(Value geom, Value srid) {
816
       return function(FUNCTION_ST_POINT, geom, srid);
817
    }
818
    
819
}