Strabon
changeset 1255:f116234d150c
when a constant was given as an argument in construct functions, then
the srid was null and the resulting geometry had srid 0.
the srid was null and the resulting geometry had srid 0.
author | Stella Giannakopoulou <sgian@di.uoa.gr> |
---|---|
date | Fri Aug 02 17:30:57 2013 +0300 (2013-08-02) |
parents | cc00626f90b3 |
children | 481d19701e7d |
files | postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java |
line diff
1.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Fri Aug 02 18:10:49 2013 +0300 1.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Fri Aug 02 17:30:57 2013 +0300 1.3 @@ -1245,6 +1245,7 @@ 1.4 else if (tmp instanceof GeneralDBStringValue) //Constant!! 1.5 { 1.6 sridNeeded = false; 1.7 + sridExpr = String.valueOf(WKTHelper.getSRID(((GeneralDBStringValue) tmp).getValue())); 1.8 break; 1.9 } 1.10 1.11 @@ -1283,12 +1284,15 @@ 1.12 } 1.13 1.14 //SRID Support 1.15 - if(expr instanceof GeneralDBSqlSpatialConstructBinary && expr.getParentNode() == null) 1.16 - { 1.17 - filter.appendComma(); 1.18 - //filter.append(((GeneralDBSqlSpatialConstructBinary)expr).getSrid()); 1.19 - filter.append(sridExpr); 1.20 - filter.closeBracket(); 1.21 + if(sridNeeded) 1.22 + { 1.23 + if(expr instanceof GeneralDBSqlSpatialConstructBinary && expr.getParentNode() == null && sridNeeded) 1.24 + { 1.25 + filter.appendComma(); 1.26 + //filter.append(((GeneralDBSqlSpatialConstructBinary)expr).getSrid()); 1.27 + filter.append(sridExpr); 1.28 + filter.closeBracket(); 1.29 + } 1.30 } 1.31 1.32 filter.appendComma(); 1.33 @@ -1507,6 +1511,7 @@ 1.34 else if (tmp instanceof GeneralDBStringValue) //Constant!! 1.35 { 1.36 sridNeeded = false; 1.37 + sridExpr = String.valueOf(WKTHelper.getSRID(((GeneralDBStringValue) tmp).getValue())); 1.38 break; 1.39 } 1.40 1.41 @@ -1633,12 +1638,15 @@ 1.42 1.43 filter.closeBracket(); 1.44 //SRID Support 1.45 - if(expr instanceof GeneralDBSqlSpatialConstructBinary && expr.getParentNode() == null) 1.46 - { 1.47 - filter.appendComma(); 1.48 - //filter.append(((GeneralDBSqlSpatialConstructBinary)expr).getSrid()); 1.49 - filter.append(sridExpr); 1.50 - filter.closeBracket(); 1.51 + if(sridNeeded) 1.52 + { 1.53 + if(expr instanceof GeneralDBSqlSpatialConstructBinary && expr.getParentNode() == null) 1.54 + { 1.55 + filter.appendComma(); 1.56 + //filter.append(((GeneralDBSqlSpatialConstructBinary)expr).getSrid()); 1.57 + filter.append(sridExpr); 1.58 + filter.closeBracket(); 1.59 + } 1.60 } 1.61 /// 1.62 } 1.63 @@ -1899,6 +1907,7 @@ 1.64 else if (tmp instanceof GeneralDBStringValue) //Constant!! 1.65 { 1.66 sridNeeded = false; 1.67 + sridExpr = String.valueOf(WKTHelper.getSRID(((GeneralDBStringValue) tmp).getValue())); 1.68 break; 1.69 } 1.70 } 1.71 @@ -2053,14 +2062,17 @@ 1.72 } 1.73 1.74 if(units.equals(OGCConstants.OGCmetre) && !((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))) 1.75 - filter.closeBracket(); //close Geometry 1.76 + filter.closeBracket(); //close Geometry 1.77 filter.closeBracket(); 1.78 //SRID Support 1.79 - if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null) 1.80 - { 1.81 - filter.appendComma(); 1.82 - filter.append(sridExpr); 1.83 - filter.closeBracket(); 1.84 + if(sridNeeded) 1.85 + { 1.86 + if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null) 1.87 + { 1.88 + filter.appendComma(); 1.89 + filter.append(sridExpr); 1.90 + filter.closeBracket(); 1.91 + } 1.92 } 1.93 /// 1.94 } 1.95 @@ -2147,6 +2159,7 @@ 1.96 else if (tmp instanceof GeneralDBStringValue) //Constant!! 1.97 { 1.98 sridNeeded = false; 1.99 + sridExpr = String.valueOf(WKTHelper.getSRID(((GeneralDBStringValue) tmp).getValue())); 1.100 break; 1.101 } 1.102 1.103 @@ -2219,17 +2232,19 @@ 1.104 1.105 filter.closeBracket(); 1.106 //Used to explicitly include SRID 1.107 - if(expr instanceof GeneralDBSqlSpatialConstructUnary && expr.getParentNode() == null) 1.108 - { 1.109 - filter.appendComma(); 1.110 - filter.append(sridExpr); 1.111 + if(sridNeeded) 1.112 + { 1.113 + if(expr instanceof GeneralDBSqlSpatialConstructUnary && expr.getParentNode() == null) 1.114 + { 1.115 + filter.appendComma(); 1.116 + filter.append(sridExpr); 1.117 + } 1.118 } 1.119 - } 1.120 + } 1.121 1.122 //Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 1.123 - protected void appendGeneralDBSpatialFunctionTriple(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) 1.124 - throws UnsupportedRdbmsOperatorException 1.125 - { 1.126 + protected void appendGeneralDBSpatialFunctionTriple(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) throws UnsupportedRdbmsOperatorException 1.127 + { 1.128 filter.openBracket(); 1.129 1.130 boolean check1a = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");