Revision 43355 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/ExpressionBuilderBase.java
ExpressionBuilderBase.java | ||
---|---|---|
42 | 42 |
public ConfigBase() { |
43 | 43 |
this.values = new HashMap<>(); |
44 | 44 |
|
45 |
this.values.put(has_spatial_functions, false); |
|
46 |
this.values.put(constant_true, "(1=1)"); |
|
47 |
this.values.put(constant_false, "(1=2)"); |
|
48 |
this.values.put(quote_for_identifiers, "\""); |
|
49 |
this.values.put(quote_for_strings, "'"); |
|
50 |
this.values.put(geometry_type_support, GeometrySupportType.WKT); |
|
51 |
this.values.put(group, "( {0} )"); |
|
45 |
this.set(Config.has_spatial_functions, false); |
|
46 |
this.set(Config.support_schemas, true); |
|
47 |
this.set(Config.constant_true, "(1=1)"); |
|
48 |
this.set(Config.constant_false, "(1=2)"); |
|
49 |
this.set(Config.quote_for_identifiers, "\""); |
|
50 |
this.set(Config.quote_for_strings, "'"); |
|
51 |
this.set(Config.geometry_type_support, GeometrySupportType.WKT); |
|
52 |
this.set(Config.group, "( {0} )"); |
|
52 | 53 |
|
53 |
this.values.put(Find_SRID, "Find_SRID(({0}), ({1}), ({2}))"); |
|
54 |
this.values.put(ST_SRID, "ST_SRID({0})"); |
|
55 |
this.values.put(ST_AsText, "ST_AsText({0})"); |
|
56 |
this.values.put(ST_AsBinary, "ST_AsBinary({0})"); |
|
57 |
this.values.put(ST_AsEWKB, "ST_AsWKB({0})"); |
|
58 |
this.values.put(ST_Contains, "ST_Contains(({0}), ({1}))"); |
|
59 |
this.values.put(ST_Crosses, "ST_Crosses(({0}), ({1}))"); |
|
60 |
this.values.put(ST_Disjoint, "ST_Disjoint(({0}), ({1}))"); |
|
61 |
this.values.put(ST_Equals, "ST_Equals(({0}), ({1}))"); |
|
62 |
this.values.put(ST_IsClosed, "ST_IsClosed({0})"); |
|
63 |
this.values.put(ST_Overlaps, "ST_Overlaps(({0}), ({1}))"); |
|
64 |
this.values.put(ST_Touches, "ST_Touches(({0}), ({1}))"); |
|
65 |
this.values.put(ST_Within, "ST_Within(({0}), ({1}))"); |
|
66 |
this.values.put(ST_Envelope, "ST_Envelope({0})"); |
|
67 |
this.values.put(ST_Intersects, "ST_Intersects(({0}), ({1}))"); |
|
68 |
this.values.put(ST_GeomFromText, "ST_GeomFromText({0}, ({1}))"); |
|
69 |
this.values.put(ST_GeomFromWKB, "ST_GeomFromWKB(({0}), ({1}))"); |
|
70 |
this.values.put(ST_GeomFromEWKB, "ST_GeomFromEWKB(({0}), ({1}))"); |
|
71 |
this.values.put(lcase, "LCASE({0})"); |
|
72 |
this.values.put(ucase, "UCASE({0})"); |
|
73 |
this.values.put(isNull, "( ({0}) IS NULL )"); |
|
74 |
this.values.put(notIsNull, "( ({0}) NOT IS NULL )"); |
|
75 |
this.values.put(operator_not, "( NOT ({0}) )"); |
|
54 |
this.set(Config.Find_SRID, "Find_SRID(({0}), ({1}), ({2}))"); |
|
55 |
this.set(Config.ST_SRID, "ST_SRID({0})"); |
|
56 |
this.set(Config.ST_AsText, "ST_AsText({0})"); |
|
57 |
this.set(Config.ST_AsBinary, "ST_AsBinary({0})"); |
|
58 |
this.set(Config.ST_AsEWKB, "ST_AsEWKB({0})"); |
|
59 |
this.set(Config.ST_Contains, "ST_Contains(({0}), ({1}))"); |
|
60 |
this.set(Config.ST_Crosses, "ST_Crosses(({0}), ({1}))"); |
|
61 |
this.set(Config.ST_Disjoint, "ST_Disjoint(({0}), ({1}))"); |
|
62 |
this.set(Config.ST_Equals, "ST_Equals(({0}), ({1}))"); |
|
63 |
this.set(Config.ST_IsClosed, "ST_IsClosed({0})"); |
|
64 |
this.set(Config.ST_Overlaps, "ST_Overlaps(({0}), ({1}))"); |
|
65 |
this.set(Config.ST_Touches, "ST_Touches(({0}), ({1}))"); |
|
66 |
this.set(Config.ST_Within, "ST_Within(({0}), ({1}))"); |
|
67 |
this.set(Config.ST_Envelope, "ST_Envelope({0})"); |
|
68 |
this.set(Config.ST_Intersects, "ST_Intersects(({0}), ({1}))"); |
|
69 |
this.set(Config.ST_GeomFromText, "ST_GeomFromText({0}, ({1}))"); |
|
70 |
this.set(Config.ST_GeomFromWKB, "ST_GeomFromWKB(({0}), ({1}))"); |
|
71 |
this.set(Config.ST_GeomFromEWKB, "ST_GeomFromEWKB(({0}), ({1}))"); |
|
72 |
|
|
73 |
// Por defecto no esta disponible la funcion ST_Simplify |
|
74 |
// El proveedor que la soporte que la defina. |
|
75 |
// this.set(Config.ST_Simplify, "ST_Simplify(({0}), ({1}))"); |
|
76 |
this.remove_functionality(Config.ST_Simplify); |
|
77 |
|
|
78 |
this.set(Config.lcase, "LCASE({0})"); |
|
79 |
this.set(Config.ucase, "UCASE({0})"); |
|
80 |
this.set(Config.isNull, "( ({0}) IS NULL )"); |
|
81 |
this.set(Config.notIsNull, "( ({0}) NOT IS NULL )"); |
|
82 |
this.set(Config.operator_not, "( NOT ({0}) )"); |
|
76 | 83 |
|
77 |
this.values.put(operator_AND, "{0} AND {1}");
|
|
78 |
this.values.put(operator_OR, "{0} OR {1}");
|
|
79 |
this.values.put(operator_EQ, "( ({0}) = ({1}) )");
|
|
80 |
this.values.put(operator_NE, "( ({0}) <> ({1}) )");
|
|
81 |
this.values.put(operator_GT, "( ({0}) > ({1}) )");
|
|
82 |
this.values.put(operator_GE, "( ({0}) >= ({1}) )");
|
|
83 |
this.values.put(operator_LT, "( ({0}) < ({1}) )");
|
|
84 |
this.values.put(operator_LE, "( ({0}) <= ({1}) )");
|
|
85 |
this.values.put(operator_LIKE, "( ({0}) LIKE ({1}) )");
|
|
86 |
this.values.put(operator_ILIKE, "( ({0}) ILIKE ({1}) )");
|
|
84 |
this.set(Config.operator_AND, "{0} AND {1}");
|
|
85 |
this.set(Config.operator_OR, "{0} OR {1}");
|
|
86 |
this.set(Config.operator_EQ, "( ({0}) = ({1}) )");
|
|
87 |
this.set(Config.operator_NE, "( ({0}) <> ({1}) )");
|
|
88 |
this.set(Config.operator_GT, "( ({0}) > ({1}) )");
|
|
89 |
this.set(Config.operator_GE, "( ({0}) >= ({1}) )");
|
|
90 |
this.set(Config.operator_LT, "( ({0}) < ({1}) )");
|
|
91 |
this.set(Config.operator_LE, "( ({0}) <= ({1}) )");
|
|
92 |
this.set(Config.operator_LIKE, "( ({0}) LIKE ({1}) )");
|
|
93 |
this.set(Config.operator_ILIKE, "( ({0}) ILIKE ({1}) )");
|
|
87 | 94 |
|
88 |
this.values.put(operator_add, "{0} + {1}");
|
|
89 |
this.values.put(operator_subst, "{0} - {1}");
|
|
90 |
this.values.put(operator_mult, "{0} * {1}");
|
|
91 |
this.values.put(operator_div, "{0} / {1}");
|
|
92 |
this.values.put(operator_concat, "{0} || {1}");
|
|
95 |
this.set(Config.operator_add, "{0} + {1}");
|
|
96 |
this.set(Config.operator_subst, "{0} - {1}");
|
|
97 |
this.set(Config.operator_mult, "{0} * {1}");
|
|
98 |
this.set(Config.operator_div, "{0} / {1}");
|
|
99 |
this.set(Config.operator_concat, "{0} || {1}");
|
|
93 | 100 |
|
94 | 101 |
} |
95 | 102 |
|
... | ... | |
735 | 742 |
return bytearray_0x(data); |
736 | 743 |
} |
737 | 744 |
|
738 |
protected String bytearray_0x(byte[] data) {
|
|
745 |
protected String bytearray_hex(byte[] data) {
|
|
739 | 746 |
StringBuilder builder = new StringBuilder(); |
740 |
builder.append("0x"); |
|
741 | 747 |
for (byte abyte : data) { |
742 | 748 |
int v = abyte & 0xff; |
743 | 749 |
builder.append(String.format("%02x", v)); |
... | ... | |
745 | 751 |
return builder.toString(); |
746 | 752 |
} |
747 | 753 |
|
754 |
protected String bytearray_0x(byte[] data) { |
|
755 |
return "0x" + bytearray_hex(data); |
|
756 |
} |
|
757 |
|
|
748 | 758 |
protected String bytearray_x(byte[] data) { |
749 |
StringBuilder builder = new StringBuilder(); |
|
750 |
builder.append("x'"); |
|
751 |
for (byte abyte : data) { |
|
752 |
int v = abyte & 0xff; |
|
753 |
builder.append(String.format("%02x", v)); |
|
754 |
} |
|
755 |
builder.append("'"); |
|
756 |
return builder.toString(); |
|
759 |
return "x'" + bytearray_hex(data) + "'"; |
|
757 | 760 |
} |
758 | 761 |
|
759 | 762 |
@Override |
... | ... | |
1005 | 1008 |
} |
1006 | 1009 |
|
1007 | 1010 |
@Override |
1011 |
public Function ST_Simplify(Value geom, Value tolerance) { |
|
1012 |
return function("ST_Simplify", config.getString(Config.ST_Simplify), tolerance); |
|
1013 |
} |
|
1014 |
|
|
1015 |
@Override |
|
1008 | 1016 |
public Function ST_Disjoint(Value geom1, Value geom2) { |
1009 | 1017 |
return function("ST_Disjoint", config.getString(Config.ST_Disjoint), geom1, geom2); |
1010 | 1018 |
} |
Also available in: Unified diff